[haskell-llvm] Vectorize loop

Timo von Holtz tvh at tvholtz.de
Sun Dec 22 15:28:08 GMT 2013


I tried to mimic the output I get from

opt -O3 dotp.s -S -vectorize-loops

using llvm-general. But somehow, I can't get it to vectorize the loop.
This is the code I used:

import LLVM.General.Context
import LLVM.General.Module
import Control.Monad.Error
import LLVM.General.PassManager
import LLVM.General.Transforms

main :: IO ()
main = do
  mt <- readFile "dotp.s"
  _ <- withContext $ \cx -> runErrorT $ withModuleFromString cx mt $ \modu -> do
    let ps = defaultCuratedPassSetSpec {optLevel=Just 3}
        ps1 = defaultPassSetSpec {transforms=[LoopVectorize]}
    _ <- withPassManager ps $ \pm -> runPassManager pm modu
    _ <- withPassManager ps1 $ \pm -> runPassManager pm modu
    moduleString modu >>= putStrLn
    print defaultVectorizeBasicBlocks
  return ()

Kind Regards,
Timo von Holtz



More information about the Haskell-llvm mailing list