[llvm-branch-commits] [llvm-branch] r115891 - /llvm/branches/ggreif/switch-opts/lib/Transforms/Scalar/CodeGenPrepare.cpp

Gabor Greif ggreif at gmail.com
Wed Oct 6 17:54:07 PDT 2010


Author: ggreif
Date: Wed Oct  6 19:54:07 2010
New Revision: 115891

URL: http://llvm.org/viewvc/llvm-project?rev=115891&view=rev
Log:
make the PHI updater work; 2008-02-05-LiveIntervalsAssert.ll now passes

Modified:
    llvm/branches/ggreif/switch-opts/lib/Transforms/Scalar/CodeGenPrepare.cpp

Modified: llvm/branches/ggreif/switch-opts/lib/Transforms/Scalar/CodeGenPrepare.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/switch-opts/lib/Transforms/Scalar/CodeGenPrepare.cpp?rev=115891&r1=115890&r2=115891&view=diff
==============================================================================
--- llvm/branches/ggreif/switch-opts/lib/Transforms/Scalar/CodeGenPrepare.cpp (original)
+++ llvm/branches/ggreif/switch-opts/lib/Transforms/Scalar/CodeGenPrepare.cpp Wed Oct  6 19:54:07 2010
@@ -896,16 +896,15 @@
   OldBranch->replaceAllUsesWith(Old->getTerminator());
   OldBranch->eraseFromParent();
 
-  BasicBlock *TrueBB = Old->getTerminator()->getSuccessor(0);
-	// Add incoming edges to PHIs where not yet present.
-	for (BasicBlock::use_iterator U = TrueBB->use_begin(),
-				 E = TrueBB->use_end(); U != E; ++U)
-		if (PHINode *PHI = dyn_cast<PHINode>(*U)) {
-			int IDX = PHI->getBasicBlockIndex(New);
-			if (IDX >= 0
-					&& PHI->getBasicBlockIndex(Old) < 0)
-				PHI->addIncoming(PHI->getIncomingValue(IDX), Old);
-		}
+  // Add incoming edges to PHIs where not yet present.
+  for (BasicBlock::use_iterator U = New->use_begin(),
+         E = New->use_end(); U != E; ++U)
+    if (PHINode *PHI = dyn_cast<PHINode>(*U)) {
+      int IDX = PHI->getBasicBlockIndex(New);
+      if (IDX >= 0 &&
+          PHI->getBasicBlockIndex(Old) < 0)
+        PHI->addIncoming(PHI->getIncomingValue(IDX), Old);
+    }
 
   return New;
 }





More information about the llvm-branch-commits mailing list