[llvm-commits] CVS: llvm/lib/Transforms/Utils/SimplifyCFG.cpp

Chris Lattner lattner at cs.uiuc.edu
Wed Aug 3 10:59:57 PDT 2005



Changes in directory llvm/lib/Transforms/Utils:

SimplifyCFG.cpp updated: 1.81 -> 1.82
---
Log message:

Fix Transforms/SimplifyCFG/2005-08-03-PHIFactorCrash.ll, a problem that
occurred while bugpointing another testcase


---
Diffs of the changes:  (+3 -2)

 SimplifyCFG.cpp |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)


Index: llvm/lib/Transforms/Utils/SimplifyCFG.cpp
diff -u llvm/lib/Transforms/Utils/SimplifyCFG.cpp:1.81 llvm/lib/Transforms/Utils/SimplifyCFG.cpp:1.82
--- llvm/lib/Transforms/Utils/SimplifyCFG.cpp:1.81	Tue Aug  2 19:59:12 2005
+++ llvm/lib/Transforms/Utils/SimplifyCFG.cpp	Wed Aug  3 12:59:45 2005
@@ -805,7 +805,7 @@
   return Changed;
 }
 
-/// HoistThenElseCodeToIf - Given a conditional branch that codes to BB1 and
+/// HoistThenElseCodeToIf - Given a conditional branch that goes to BB1 and
 /// BB2, hoist any common code in the two blocks up into the branch block.  The
 /// caller of this function guarantees that BI's block dominates BB1 and BB2.
 static bool HoistThenElseCodeToIf(BranchInst *BI) {
@@ -818,7 +818,8 @@
   BasicBlock *BB2 = BI->getSuccessor(1);  // The false destination
 
   Instruction *I1 = BB1->begin(), *I2 = BB2->begin();
-  if (I1->getOpcode() != I2->getOpcode() || !I1->isIdenticalTo(I2))
+  if (I1->getOpcode() != I2->getOpcode() || !I1->isIdenticalTo(I2) ||
+      isa<PHINode>(I1))
     return false;
 
   // If we get here, we can hoist at least one instruction.






More information about the llvm-commits mailing list