[LLVMdev] Something about the andersens pass

Robert Zeh robert.a.zeh at gmail.com
Thu Jan 24 17:21:39 PST 2008


I may have found a bug in the andersends pass, but before I try to  
strip the code down to something reasonable I'd like to make sure I'm  
not misunderstanding anything.  This is against the current SVN head,  
on my Mac OS 10.5 box.

1) I'm compiling a bunch of C++ code with llvm-g++ (4.0.1).  The  
compiled code includes the gcc 4.0.1 implementation for dynamic_cast  
(so it can be inlined).
2) I load the library as a module, and generate some functions that  
call the llvm-g++ compiled code.
3) I aggressively inline my generated code with a function pass  
manager, and end up with a monster function.
4) I run the following pass:

  {
     PassManager PM;
     PM.add(new TargetData(*EE->getTargetData()));
     PM.add(createInstructionCombiningPass());
     PM.run(*qModule);
   }

I then run another pass:
   PassManager PM;
   PM.add(new TargetData(*EE->getTargetData()));
   PM.add(createVerifierPass());
   //PM.add(createAndersensPass());  // Seems to break dynamic casts  
in combo with load value numbering
   PM.add(createLoadValueNumberingPass());
   PM.add(createGCSEPass());
   PM.add(createAggressiveDCEPass());
   PM.add(createDeadInstEliminationPass());
   PM.run(*qModule);

Next, I call my monster function and it works as expected.

But if I uncomment the call to createAndersendsPass() my code fails  
(because something goes wrong with the dynamic cast).

Is what I'm doing supposed to work?  I have I missed something with  
the pass manager?

Thanks,
Robert Zeh




More information about the llvm-dev mailing list