[llvm] r253596 - Revert r253253 and r253126: "Don't recompute LCSSA after loop-unrolling when possible."

Michael Zolotukhin via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 19 12:28:32 PST 2015


Author: mzolotukhin
Date: Thu Nov 19 14:28:32 2015
New Revision: 253596

URL: http://llvm.org/viewvc/llvm-project?rev=253596&view=rev
Log:
Revert r253253 and r253126: "Don't recompute LCSSA after loop-unrolling when possible."

The change exposed a bug in IndVarSimplify (PR25578), which led to a
failure (PR25538). When the bug is fixed, this patch can be reapplied.

The tests are kept in tree, as they're useful anyway, and will not break
with this revert.

Modified:
    llvm/trunk/lib/Transforms/Utils/LoopUnroll.cpp

Modified: llvm/trunk/lib/Transforms/Utils/LoopUnroll.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/LoopUnroll.cpp?rev=253596&r1=253595&r2=253596&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/LoopUnroll.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/LoopUnroll.cpp Thu Nov 19 14:28:32 2015
@@ -221,12 +221,6 @@ bool llvm::UnrollLoop(Loop *L, unsigned
 
   // Are we eliminating the loop control altogether?
   bool CompletelyUnroll = Count == TripCount;
-  SmallVector<BasicBlock *, 4> ExitBlocks;
-  L->getExitBlocks(ExitBlocks);
-  Loop *ParentL = L->getParentLoop();
-  bool AllExitsAreInsideParentLoop = !ParentL ||
-      std::all_of(ExitBlocks.begin(), ExitBlocks.end(),
-                  [&](BasicBlock *BB) { return ParentL->contains(BB); });
 
   // We assume a run-time trip count if the compiler cannot
   // figure out the loop trip count and the unroll-runtime
@@ -550,7 +544,7 @@ bool llvm::UnrollLoop(Loop *L, unsigned
     if (!OuterL && !CompletelyUnroll)
       OuterL = L;
     if (OuterL) {
-      bool Simplified = simplifyLoop(OuterL, DT, LI, PP, SE, AC);
+      simplifyLoop(OuterL, DT, LI, PP, SE, AC);
 
       // LCSSA must be performed on the outermost affected loop. The unrolled
       // loop's last loop latch is guaranteed to be in the outermost loop after
@@ -560,11 +554,7 @@ bool llvm::UnrollLoop(Loop *L, unsigned
         while (OuterL->getParentLoop() != LatchLoop)
           OuterL = OuterL->getParentLoop();
 
-      if (CompletelyUnroll && (!AllExitsAreInsideParentLoop || Simplified))
-        formLCSSARecursively(*OuterL, *DT, LI, SE);
-      else
-        assert(OuterL->isLCSSAForm(*DT) &&
-               "Loops should be in LCSSA form after loop-unroll.");
+      formLCSSARecursively(*OuterL, *DT, LI, SE);
     }
   }
 




More information about the llvm-commits mailing list