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

Devang Patel dpatel at apple.com
Tue Oct 17 18:17:11 PDT 2006


Now, loop unrolling is enable at -O2 only if it is not explicitly set/ 
reset using -f[no-]unroll-loops.

-
Devang

Index: opts.c
===================================================================
--- opts.c      (revision 118611)
+++ opts.c      (working copy)
@@ -548,6 +548,11 @@ void set_flags_from_O (unsigned int cmdl
            /* PRE tends to generate bigger code.  */
            flag_tree_pre = 1;
         }
+      /* APPLE LOCAL begin LLVM */
+      /* Enable loop unrolling at -O2 if -f[no-]unroll-loops is not  
used.  */
+      if (!flag_unroll_loops_set)
+        flag_unroll_loops = 1;
+      /* APPLE LOCAL end LLVM */
      }

    if (optimize >= 3)
Index: llvm-backend.cpp
===================================================================
--- llvm-backend.cpp    (revision 119003)
+++ llvm-backend.cpp    (working copy)
@@ -243,7 +243,7 @@ void llvm_asm_file_start(void) {
      PM->add(createLoopUnswitchPass());         // Unswitch loops.
      PM->add(createInstructionCombiningPass()); // Clean up after  
LICM/reassoc
      PM->add(createIndVarSimplifyPass());       // Canonicalize indvars
-    if (flag_unroll_loops || optimize > 1)
+    if (flag_unroll_loops)
        PM->add(createLoopUnrollPass());           // Unroll small loops
      PM->add(createInstructionCombiningPass()); // Clean up after the  
unroller




More information about the llvm-commits mailing list