Enable SCEV-based unrolling by default.
authorAndrew Trick <atrick@apple.com>
Fri, 2 Sep 2011 17:26:28 +0000 (17:26 +0000)
committerAndrew Trick <atrick@apple.com>
Fri, 2 Sep 2011 17:26:28 +0000 (17:26 +0000)
This changes loop unrolling to use the same mechanism for trip count
computation as indvars. This is a stronger check that tends to unroll
more loops. A very common side-effect is that many single iteration
loops will be removed sooner. The real goal was simply to remove
dependence on canonical IVs.

x86 is break even.
ARM performance changes to expect (+ is good):
External/SPEC/CFP2000/183.equake/183.equake +13%
SingleSource/Benchmarks/Dhrystone/fldry     +21%
MultiSource/Applications/spiff/spiff         +3%
SingleSource/Benchmarks/Stanford/Puzzle     -14%

The Puzzle regression is actually an improvement in loop optimization
that defeats GVN: rdar://problem/10065079.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139009 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/LoopUnrollPass.cpp

index dab3ac42eaf4db3a28e071723dc25599b9ed79a2..cca7ba0bd4e47b40f15d000763fce02ba68bcf61 100644 (file)
@@ -39,9 +39,9 @@ UnrollAllowPartial("unroll-allow-partial", cl::init(false), cl::Hidden,
   cl::desc("Allows loops to be partially unrolled until "
            "-unroll-threshold loop size is reached."));
 
-// Temporary flag to be made default shortly.
+// Temporary flag to be removed in 3.0
 static cl::opt<bool>
-UnrollWithSCEV("unroll-scev", cl::init(false), cl::Hidden,
+NoSCEVUnroll("disable-unroll-scev", cl::init(false), cl::Hidden,
   cl::desc("Use ScalarEvolution to analyze loop trip counts for unrolling"));
 
 namespace {
@@ -145,7 +145,7 @@ bool LoopUnroll::runOnLoop(Loop *L, LPPassManager &LPM) {
   // Find trip count and trip multiple if count is not available
   unsigned TripCount = 0;
   unsigned TripMultiple = 1;
-  if (UnrollWithSCEV) {
+  if (!NoSCEVUnroll) {
     // Find "latch trip count". UnrollLoop assumes that control cannot exit
     // via the loop latch on any iteration prior to TripCount. The loop may exit
     // early via an earlier branch.