Change break critical edges to not remove, then insert, PHI node entries.
[oota-llvm.git] / lib / Transforms / Utils / BreakCriticalEdges.cpp
index acc1e2cd3f7aca3cf87a177c563333bae8643004..59ec01c7d585f5184e7ebf0c6bce8009c2e5328b 100644 (file)
@@ -124,8 +124,8 @@ bool llvm::SplitCriticalEdge(TerminatorInst *TI, unsigned SuccNum, Pass *P) {
     // We no longer enter through TIBB, now we come in through NewBB.  Revector
     // exactly one entry in the PHI node that used to come from TIBB to come
     // from NewBB.
-    Value *InVal = PN->removeIncomingValue(TIBB, false);
-    PN->addIncoming(InVal, NewBB);
+    int BBIdx = PN->getBasicBlockIndex(TIBB);
+    PN->setIncomingBlock(BBIdx, NewBB);
   }
 
   // If we don't have a pass object, we can't update anything...