Make LoopUnroll not die on LCSSA Phis. This makes lencod work again.
authorOwen Anderson <resistor@mac.com>
Wed, 19 Jul 2006 05:45:14 +0000 (05:45 +0000)
committerOwen Anderson <resistor@mac.com>
Wed, 19 Jul 2006 05:45:14 +0000 (05:45 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29198 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/LoopUnroll.cpp

index 4f2a0e0b62e049dda945b5d34261c1eee4912d8f..6f7df426f16c17a32628b67f0d04cec92399cc8a 100644 (file)
@@ -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.