add an instcombine pass to clean up after heavy-lifting IP passes
[oota-llvm.git] / tools / gccld / GenerateCode.cpp
index db1caa82709f9bd630f5454763b15d9b2ab093a7..e70bda307a718af2b683f91cc0b98c6ce5f73a2b 100644 (file)
@@ -239,6 +239,12 @@ int llvm::GenerateBytecode(Module *M, int StripLevel, bool Internalize,
     // Remove unused arguments from functions...
     addPass(Passes, createDeadArgEliminationPass());
 
+    // Reduce the code after globalopt and ipsccp.  Both can open up significant
+    // simplification opportunities, and both can propagate functions through
+    // function pointers.  When this happens, we often have to resolve varargs
+    // calls, etc, so let instcombine do this.
+    addPass(Passes, createInstructionCombiningPass());
+    
     if (!DisableInline)
       addPass(Passes, createFunctionInliningPass()); // Inline small functions