summaryrefslogtreecommitdiffstats
path: root/lib/Transforms/Scalar/LoopUnroll.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Transforms/Scalar/LoopUnroll.cpp')
-rw-r--r--lib/Transforms/Scalar/LoopUnroll.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/Transforms/Scalar/LoopUnroll.cpp b/lib/Transforms/Scalar/LoopUnroll.cpp
index 4f2a0e0..6f7df42 100644
--- a/lib/Transforms/Scalar/LoopUnroll.cpp
+++ b/lib/Transforms/Scalar/LoopUnroll.cpp
@@ -269,6 +269,12 @@ bool LoopUnroll::visitLoop(Loop *L) {
// FIXME: Should update dominator analyses
+ // Remove LCSSA Phis from the exit block
+ for (BasicBlock::iterator ExitInstr = LoopExit->begin();
+ PHINode* PN = dyn_cast<PHINode>(ExitInstr); ++ExitInstr) {
+ PN->replaceAllUsesWith(PN->getOperand(0));
+ PN->eraseFromParent();
+ }
// Now that everything is up-to-date that will be, we fold the loop block into
// the preheader and exit block, updating our analyses as we go.