diff options
author | Chris Lattner <sabre@nondot.org> | 2006-10-29 21:01:20 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2006-10-29 21:01:20 +0000 |
commit | 6a586c8d9a7ba032adf0619d06473310c41cae14 (patch) | |
tree | 435524f5c611553541ab9b412f9f311514746e92 | |
parent | 1bc33f7c81d5400e96edd58317cc5f551dc9e059 (diff) | |
download | external_llvm-6a586c8d9a7ba032adf0619d06473310c41cae14.zip external_llvm-6a586c8d9a7ba032adf0619d06473310c41cae14.tar.gz external_llvm-6a586c8d9a7ba032adf0619d06473310c41cae14.tar.bz2 |
fix Generic/2006-10-29-Crash.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31281 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp index 6381f52..9794af1 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp @@ -824,6 +824,12 @@ bool SelectionDAGLowering::isExportableFromCurrentBlock(Value *V, return true; } +static bool InBlock(const Value *V, const BasicBlock *BB) { + if (const Instruction *I = dyn_cast<Instruction>(V)) + return I->getParent() == BB; + return true; +} + /// FindMergedConditions - If Cond is an expression like void SelectionDAGLowering::FindMergedConditions(Value *Cond, MachineBasicBlock *TBB, @@ -834,7 +840,9 @@ void SelectionDAGLowering::FindMergedConditions(Value *Cond, BinaryOperator *BOp = dyn_cast<BinaryOperator>(Cond); if (!BOp || (unsigned)BOp->getOpcode() != Opc || !BOp->hasOneUse() || - BOp->getParent() != CurBB->getBasicBlock()) { + BOp->getParent() != CurBB->getBasicBlock() || + !InBlock(BOp->getOperand(0), CurBB->getBasicBlock()) || + !InBlock(BOp->getOperand(1), CurBB->getBasicBlock())) { const BasicBlock *BB = CurBB->getBasicBlock(); // If the leaf of the tree is a setcond inst, merge the condition into the |