aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms/Utils/BreakCriticalEdges.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Transforms/Utils/BreakCriticalEdges.cpp')
-rw-r--r--lib/Transforms/Utils/BreakCriticalEdges.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/Transforms/Utils/BreakCriticalEdges.cpp b/lib/Transforms/Utils/BreakCriticalEdges.cpp
index 178e8ca195..8e00f9c613 100644
--- a/lib/Transforms/Utils/BreakCriticalEdges.cpp
+++ b/lib/Transforms/Utils/BreakCriticalEdges.cpp
@@ -119,8 +119,11 @@ bool llvm::SplitCriticalEdge(TerminatorInst *TI, unsigned SuccNum, Pass *P) {
//
for (BasicBlock::iterator I = DestBB->begin();
PHINode *PN = dyn_cast<PHINode>(I); ++I) {
- // We no longer enter through TIBB, now we come in through NewBB.
- PN->replaceUsesOfWith(TIBB, NewBB);
+ // 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);
}
// If we don't have a pass object, we can't update anything...