Change break critical edges to not remove, then insert, PHI node entries.
authorChris Lattner <sabre@nondot.org>
Fri, 12 Aug 2005 21:58:07 +0000 (21:58 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 12 Aug 2005 21:58:07 +0000 (21:58 +0000)
Instead, just update the BB in-place.  This is both faster, and it prevents
split-critical-edges from shuffling the PHI argument list unneccesarily.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22765 91177308-0d34-0410-b5e6-96231b3b80d8

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...