aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms/Utils/SimplifyCFG.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-08-03 17:59:45 +0000
committerChris Lattner <sabre@nondot.org>2005-08-03 17:59:45 +0000
commit6306d07aa8cf71e3c7fed7f295665f53595473eb (patch)
treec4dcd78ec316b2c0400a4d568bcd73aeaac2849a /lib/Transforms/Utils/SimplifyCFG.cpp
parentb06f677c5399d13392f0d9561b76c10f97dbf85a (diff)
Fix Transforms/SimplifyCFG/2005-08-03-PHIFactorCrash.ll, a problem that
occurred while bugpointing another testcase git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22621 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Utils/SimplifyCFG.cpp')
-rw-r--r--lib/Transforms/Utils/SimplifyCFG.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/Transforms/Utils/SimplifyCFG.cpp b/lib/Transforms/Utils/SimplifyCFG.cpp
index 742efe6184..2bf9ae89f9 100644
--- a/lib/Transforms/Utils/SimplifyCFG.cpp
+++ b/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -805,7 +805,7 @@ static bool FoldValueComparisonIntoPredecessors(TerminatorInst *TI) {
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 @@ static bool HoistThenElseCodeToIf(BranchInst *BI) {
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.