diff options
author | Nate Begeman <natebegeman@mac.com> | 2006-02-18 02:40:58 +0000 |
---|---|---|
committer | Nate Begeman <natebegeman@mac.com> | 2006-02-18 02:40:58 +0000 |
commit | b0d04a7deaf1ffc78f2eb85295af987a54223c00 (patch) | |
tree | c7e09d3617108d217d8f54720c41399a24370b38 /lib/CodeGen/SelectionDAG/SelectionDAG.cpp | |
parent | 2b1527157116ba6045667eb29568f2f460d7b670 (diff) |
Add checks to make sure we don't create bogus extend nodes, and fix a bug
where we were doing exactly that which was causing failures on x86 and
alpha.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26284 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG/SelectionDAG.cpp')
-rw-r--r-- | lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index bb66825cd3..59449625e6 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp @@ -1047,22 +1047,26 @@ SDOperand SelectionDAG::getNode(unsigned Opcode, MVT::ValueType VT, return Operand; // Factor of one node? No factor. case ISD::SIGN_EXTEND: if (Operand.getValueType() == VT) return Operand; // noop extension + assert(Operand.getValueType() < VT && "Invalid sext node, dst < src!"); if (OpOpcode == ISD::SIGN_EXTEND || OpOpcode == ISD::ZERO_EXTEND) return getNode(OpOpcode, VT, Operand.Val->getOperand(0)); break; case ISD::ZERO_EXTEND: if (Operand.getValueType() == VT) return Operand; // noop extension + assert(Operand.getValueType() < VT && "Invalid zext node, dst < src!"); if (OpOpcode == ISD::ZERO_EXTEND) // (zext (zext x)) -> (zext x) return getNode(ISD::ZERO_EXTEND, VT, Operand.Val->getOperand(0)); break; case ISD::ANY_EXTEND: if (Operand.getValueType() == VT) return Operand; // noop extension + assert(Operand.getValueType() < VT && "Invalid anyext node, dst < src!"); if (OpOpcode == ISD::ZERO_EXTEND || OpOpcode == ISD::SIGN_EXTEND) // (ext (zext x)) -> (zext x) and (ext (sext x)) -> (sext x) return getNode(OpOpcode, VT, Operand.Val->getOperand(0)); break; case ISD::TRUNCATE: if (Operand.getValueType() == VT) return Operand; // noop truncate + assert(Operand.getValueType() > VT && "Invalid truncate node, src < dst!"); if (OpOpcode == ISD::TRUNCATE) return getNode(ISD::TRUNCATE, VT, Operand.Val->getOperand(0)); else if (OpOpcode == ISD::ZERO_EXTEND || OpOpcode == ISD::SIGN_EXTEND || |