[LLVMdev] add pass to O2. use as "clang -O2 .."

Duncan Sands baldrick at free.fr
Tue Nov 15 01:12:44 PST 2011


Hi Yuanfang,

> I wrote a transforming looppass for my project, opt --help can see it. I want
> clang to use my pass too, so that I don't have to compile to IR, opt, and then
> llc to binary manually. Now I am trying to add my pass to O2 by mimicking LICM
> pass.
>
> I add a line "MPM.add(createMyPass());"
> in PassManagerBuilder::populateModulePassManager, and got assertion fail "void
> llvm::PMTopLevelManager::schedulePass(llvm::Pass*): Assertion `PI && "Expected
> required passes to be initialized"' failed."  I can't figure out how to solve
> this?  thanks for any inputs.

maybe you need to use INITIALIZE_PASS_DEPENDENCY.  If you grep for this in
lib/Transforms/Scalar you will see several examples.

Ciao, Duncan.

>
> yuanfang
>
>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev




More information about the llvm-dev mailing list