diff options
author | Chris Lattner <sabre@nondot.org> | 2005-08-07 05:00:44 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2005-08-07 05:00:44 +0000 |
commit | 0c26a0b9024b77f7e8c78e648ee0bbd2e15ae3f8 (patch) | |
tree | 9378e9c1d07f6c0178a55a0984760854618bd8e8 /llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp | |
parent | f4dd8c445c6680bc82f7fd42bf268b64cc04012d (diff) | |
download | bcm5719-llvm-0c26a0b9024b77f7e8c78e648ee0bbd2e15ae3f8.tar.gz bcm5719-llvm-0c26a0b9024b77f7e8c78e648ee0bbd2e15ae3f8.zip |
add a small simplification that can be exposed after promotion/expansion
llvm-svn: 22691
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index 6a018a546c1..a9907fa55a9 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp @@ -770,8 +770,6 @@ static bool MaskedValueIsZero(const SDOperand &Op, uint64_t Mask, // If we know the result of a setcc has the top bits zero, use this info. switch (Op.getOpcode()) { - case ISD::UNDEF: - return true; case ISD::Constant: return (cast<ConstantSDNode>(Op)->getValue() & Mask) == 0; @@ -1044,6 +1042,13 @@ SDOperand SelectionDAG::getNode(unsigned Opcode, MVT::ValueType VT, MVT::getSizeInBits(cast<VTSDNode>(N1.getOperand(1))->getVT()); if ((C2 & (~0ULL << ExtendBits)) == 0) return getNode(ISD::AND, VT, N1.getOperand(0), N2); + } else if (N1.getOpcode() == ISD::OR) { + if (ConstantSDNode *ORI = dyn_cast<ConstantSDNode>(N1.getOperand(1))) + if ((ORI->getValue() & C2) == C2) { + // If the 'or' is setting all of the bits that we are masking for, + // we know the result of the AND will be the AND mask itself. + return N2; + } } break; case ISD::OR: |