[LLVMdev] Interactions between module and loop passes
Duncan Sands
baldrick at free.fr
Fri Mar 2 06:36:08 PST 2012
Hi Pablo,
> I have a code with three passes (one loop pass and two module passes)
> and my own pass manager. If I schedule the loop pass between the others,
> my code segfaults.
when developing with LLVM you should configure with --enable-assertions.
That way you should get an assert failure with a helpful message rather
than a crash.
Is there any explanation why loop passes cannot be
> scheduled between two module passes? Perhaps I misunderstood the
> behaviour of pass managers.
>
> I paste here my "usage" information:
>
> int main(...){
>
> Module m = ... //Read module
> PassManager pm;
>
> pm.add(new ModPass1);
> pm.add(new LoopPass);
> pm.add(new ModPass2);
> pm.run(m);
>
> }
>
> class ModPass1 : public ModulePass{
>
> virtual void getAnalysisUsage(AnalysisUsage&AU) const{
> AU.setPreservesAll();
> }
> };
>
> class LoopPass : public LoopPass{
>
> virtual void getAnalysisUsage(AnalysisUsage&AU) const{
> AU.setRequires<ModPass1>();
I'm pretty sure a LoopPass cannot require a ModulePass.
Ciao, Duncan.
> AU.setPreservesAll();
> }
> };
>
> class ModPass2 : public ModulePass{
>
> virtual void getAnalysisUsage(AnalysisUsage&AU) const{
>
> AU.setRequires<LoopPass>();
> AU.setPreservesAll();
> }
> };
>
>
> If I remove any of the passes (updating the usage information), it's OK.
> If I transform the loop pass into a module pass, it also works.
>
> Thanks ahead,
>
More information about the llvm-dev
mailing list