[llvm-commits] [llvm-gcc-4.2] r50039 - /llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp

Duncan Sands baldrick at free.fr
Mon Apr 21 01:25:58 PDT 2008


Author: baldrick
Date: Mon Apr 21 03:25:57 2008
New Revision: 50039

URL: http://llvm.org/viewvc/llvm-project?rev=50039&view=rev
Log:
Fix PR2244.  Run the inliner if flag_inline_trees
is set, and not only if flag_inline_trees > 1.
This copies the logic used by the gcc optimizers:
only front-ends pay any attention to whether
flag_inline_trees contains 1 or 2, the middle-end
only cares whether it is 0 or not zero.  While
there, reposition the StripDeadPrototypes past so
that it is run at the same point as in opt, and
add a StripDeadTypes pass like in opt.  Chris did
suggest not bothering to run these passes because
dead prototypes and types tend not to be generated
by llvm-gcc in the first place, but for the moment
let's try it this way.

Modified:
    llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp

Modified: llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp?rev=50039&r1=50038&r2=50039&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Mon Apr 21 03:25:57 2008
@@ -356,14 +356,15 @@
     if (flag_unit_at_a_time && flag_exceptions)
       PM->add(createPruneEHPass());               // Remove dead EH info
 
+    if (flag_inline_trees)                      // respect -fno-inline-functions
+      PM->add(createFunctionInliningPass());    // Inline small functions
+
     if (optimize > 1) {
-      if (flag_inline_trees > 1)                // respect -fno-inline-functions
-        PM->add(createFunctionInliningPass());  // Inline small functions
       if (flag_unit_at_a_time && !lang_hooks.flag_no_builtin())
         PM->add(createSimplifyLibCallsPass());  // Library Call Optimizations
 
       if (optimize > 2)
-    	PM->add(createArgumentPromotionPass()); // Scalarize uninlined fn args
+        PM->add(createArgumentPromotionPass()); // Scalarize uninlined fn args
     }
     
     PM->add(createTailDuplicationPass());       // Simplify cfg by copying code
@@ -396,10 +397,14 @@
     PM->add(createDeadStoreEliminationPass());  // Delete dead stores
     PM->add(createAggressiveDCEPass());         // SSA based 'Aggressive DCE'
     PM->add(createCFGSimplificationPass());     // Merge & remove BBs
-    
+
+    if (flag_unit_at_a_time) {
+      PM->add(createStripDeadPrototypesPass());   // Get rid of dead prototypes
+      PM->add(createDeadTypeEliminationPass());   // Eliminate dead types
+    }
+
     if (optimize > 1 && flag_unit_at_a_time)
       PM->add(createConstantMergePass());       // Merge dup global constants 
-    PM->add(createStripDeadPrototypesPass());   // Get rid of dead prototypes
   }
   
   if (emit_llvm_bc) {





More information about the llvm-commits mailing list