Changes in directory llvm/lib/CodeGen/SelectionDAG:
DAGCombiner.cpp updated: 1.291 -> 1.292 --- Log message: When replacing a node in SimplifyDemandedBits, if the old node used any single-use nodes, they will be dead soon. Make sure to remove them before processing other nodes. This implements CodeGen/X86/shl_elim.ll --- Diffs of the changes: (+8 -1) DAGCombiner.cpp | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletion(-) Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.291 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.292 --- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.291 Tue Apr 17 14:03:21 2007 +++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Tue Apr 17 22:05:22 2007 @@ -182,6 +182,13 @@ // something else needing this node. if (TLO.Old.Val->use_empty()) { removeFromWorkList(TLO.Old.Val); + + // If the operands of this node are only used by the node, they will now + // be dead. Make sure to visit them first to delete dead nodes early. + for (unsigned i = 0, e = TLO.Old.Val->getNumOperands(); i != e; ++i) + if (TLO.Old.Val->getOperand(i).Val->hasOneUse()) + AddToWorkList(TLO.Old.Val->getOperand(i).Val); + DAG.DeleteNode(TLO.Old.Val); } return true; @@ -1838,6 +1845,7 @@ // if (srl x, c) is known to be zero, return 0 if (N1C && TLI.MaskedValueIsZero(SDOperand(N, 0), ~0ULL >> (64-OpSizeInBits))) return DAG.getConstant(0, VT); + // fold (srl (srl x, c1), c2) -> 0 or (srl x, c1+c2) if (N1C && N0.getOpcode() == ISD::SRL && N0.getOperand(1).getOpcode() == ISD::Constant) { @@ -1899,7 +1907,6 @@ return DAG.getNode(ISD::XOR, VT, Op, DAG.getConstant(1, VT)); } } - return SDOperand(); } _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits