[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp

Chris Lattner sabre at nondot.org
Sun Oct 29 13:01:34 PST 2006



Changes in directory llvm/lib/CodeGen/SelectionDAG:

SelectionDAGISel.cpp updated: 1.306 -> 1.307
---
Log message:

fix Generic/2006-10-29-Crash.ll


---
Diffs of the changes:  (+9 -1)

 SelectionDAGISel.cpp |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletion(-)


Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.306 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.307
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.306	Sun Oct 29 12:23:37 2006
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp	Sun Oct 29 15:01:20 2006
@@ -824,6 +824,12 @@
   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 @@
   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






More information about the llvm-commits mailing list