diff options
author | Chris Lattner <sabre@nondot.org> | 2006-03-01 21:47:21 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2006-03-01 21:47:21 +0000 |
commit | 1ec05d1bb4e8903321caf29f57a805952f5b8b86 (patch) | |
tree | f7ddd323975931045f0c6a15d91277c105c7ee07 /lib/CodeGen/SelectionDAG/DAGCombiner.cpp | |
parent | 358d5afcbdc609f5db7c76e4c78d4205ff3179c8 (diff) |
Fix CodeGen/Generic/2006-03-01-dagcombineinfloop.ll, an infinite loop
in the dag combiner on 176.gcc on x86.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26459 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG/DAGCombiner.cpp')
-rw-r--r-- | lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index e235a7b2e4..280c7081f1 100644 --- a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -1018,14 +1018,19 @@ SDOperand DAGCombiner::visitAND(SDNode *N) { return N1; // fold (and (any_ext V), c) -> (zero_ext V) if 'and' only clears top bits. if (N1C && N0.getOpcode() == ISD::ANY_EXTEND) { - unsigned InBits = MVT::getSizeInBits(N0.getOperand(0).getValueType()); + unsigned InMask = MVT::getIntVTBitMask(N0.getOperand(0).getValueType()); if (TLI.MaskedValueIsZero(N0.getOperand(0), - ~N1C->getValue() & ((1ULL << InBits)-1))) { + ~N1C->getValue() & InMask)) { + SDOperand Zext = DAG.getNode(ISD::ZERO_EXTEND, N0.getValueType(), + N0.getOperand(0)); + + // Replace uses of the AND with uses of the Zero extend node. + CombineTo(N, Zext); + // We actually want to replace all uses of the any_extend with the // zero_extend, to avoid duplicating things. This will later cause this // AND to be folded. - CombineTo(N0.Val, DAG.getNode(ISD::ZERO_EXTEND, N0.getValueType(), - N0.getOperand(0))); + CombineTo(N0.Val, Zext); return SDOperand(); } } |