[llvm-commits] Add predicate simplifier and control loop unrolling

Devang Patel dpatel at apple.com
Tue Oct 17 16:48:34 PDT 2006


This llvm-gcc4 patch enabled predicate simplification pass. And now  
loop unrolling is enabled only at -O2 or when -funroll-loops is used.

Index: llvm-backend.cpp
===================================================================
--- llvm-backend.cpp    (revision 119002)
+++ llvm-backend.cpp    (working copy)
@@ -234,6 +234,7 @@ void llvm_asm_file_start(void) {
      PM->add(createCFGSimplificationPass());    // Merge & remove BBs
      PM->add(createScalarReplAggregatesPass()); // Break up aggregate  
allocas
      PM->add(createInstructionCombiningPass()); // Combine silly seq's
+    PM->add(createPredicateSimplifierPass());  // Canonicalize  
registers
      PM->add(createCondPropagationPass());      // Propagate  
conditionals
      PM->add(createTailCallEliminationPass());  // Eliminate tail calls
      PM->add(createCFGSimplificationPass());    // Merge & remove BBs
@@ -242,7 +243,8 @@ void llvm_asm_file_start(void) {
      PM->add(createLoopUnswitchPass());         // Unswitch loops.
      PM->add(createInstructionCombiningPass()); // Clean up after  
LICM/reassoc
      PM->add(createIndVarSimplifyPass());       // Canonicalize indvars
-    PM->add(createLoopUnrollPass());           // Unroll small loops
+    if (flag_unroll_loops || optimize > 2)
+      PM->add(createLoopUnrollPass());           // Unroll small loops
      PM->add(createInstructionCombiningPass()); // Clean up after the  
unroller

      if (optimize > 2)




More information about the llvm-commits mailing list