summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Zolotukhin <mzolotukhin@apple.com>2015-11-16 21:17:26 +0000
committerMichael Zolotukhin <mzolotukhin@apple.com>2015-11-16 21:17:26 +0000
commit927bdba29d5f0fbb6e98b204bdf0083e0dda7b62 (patch)
treecb1f22c9f2d7b64a068352bb65d4c4aac06b65a4
parent46e331688800d785770f64c41804e6271127dd80 (diff)
downloadbcm5719-llvm-927bdba29d5f0fbb6e98b204bdf0083e0dda7b62.tar.gz
bcm5719-llvm-927bdba29d5f0fbb6e98b204bdf0083e0dda7b62.zip
[PR25538]: Fix a failure caused by r253126.
In r253126 we stopped to recompute LCSSA after loop unrolling in all cases, except the unrolling is full and at least one of the loop exits is outside the parent loop. In other cases the transformation should not break LCSSA, but it turned out, that we also call SimplifyLoop on the parent loop, which might break LCSSA by itself. This fix just triggers LCSSA recomputation in this case as well. I'm committing it without a test case for now, but I'll try to invent one. It's a bit tricky because in an isolated test LoopSimplify would be scheduled before LoopUnroll, and thus will change the test and hide the problem. llvm-svn: 253253
-rw-r--r--llvm/lib/Transforms/Utils/LoopUnroll.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Utils/LoopUnroll.cpp b/llvm/lib/Transforms/Utils/LoopUnroll.cpp
index 3999989ec89..44dde1b51cf 100644
--- a/llvm/lib/Transforms/Utils/LoopUnroll.cpp
+++ b/llvm/lib/Transforms/Utils/LoopUnroll.cpp
@@ -550,7 +550,7 @@ bool llvm::UnrollLoop(Loop *L, unsigned Count, unsigned TripCount,
if (!OuterL && !CompletelyUnroll)
OuterL = L;
if (OuterL) {
- simplifyLoop(OuterL, DT, LI, PP, SE, AC);
+ bool Simplified = 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,7 +560,7 @@ bool llvm::UnrollLoop(Loop *L, unsigned Count, unsigned TripCount,
while (OuterL->getParentLoop() != LatchLoop)
OuterL = OuterL->getParentLoop();
- if (CompletelyUnroll && !AllExitsAreInsideParentLoop)
+ if (CompletelyUnroll && (!AllExitsAreInsideParentLoop || Simplified))
formLCSSARecursively(*OuterL, *DT, LI, SE);
else
assert(OuterL->isLCSSAForm(*DT) &&
OpenPOWER on IntegriCloud