diff options
author | Evan Cheng <evan.cheng@apple.com> | 2011-03-15 02:22:10 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2011-03-15 02:22:10 +0000 |
commit | c5c2cfa38114f7b71d1af3137d3d3afa4031d5de (patch) | |
tree | 38244bea8465968f52d6e694829f3b6626646183 /llvm/lib/CodeGen | |
parent | 928de167936c1f0c9cf24cd467bcdcb6d61a64ab (diff) | |
download | bcm5719-llvm-c5c2cfa38114f7b71d1af3137d3d3afa4031d5de.tar.gz bcm5719-llvm-c5c2cfa38114f7b71d1af3137d3d3afa4031d5de.zip |
sext(undef) = 0, because the top bits will all be the same.
zext(undef) = 0, because the top bits will be zero.
llvm-svn: 127649
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index bcb0ffe3a5b..c2711c8097d 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp @@ -2483,7 +2483,8 @@ SDValue SelectionDAG::getNode(unsigned Opcode, DebugLoc DL, if (OpOpcode == ISD::SIGN_EXTEND || OpOpcode == ISD::ZERO_EXTEND) return getNode(OpOpcode, DL, VT, Operand.getNode()->getOperand(0)); else if (OpOpcode == ISD::UNDEF) - return getUNDEF(VT); + // sext(undef) = 0, because the top bits will all be the same. + return getConstant(0, VT); break; case ISD::ZERO_EXTEND: assert(VT.isInteger() && Operand.getValueType().isInteger() && @@ -2498,6 +2499,9 @@ SDValue SelectionDAG::getNode(unsigned Opcode, DebugLoc DL, if (OpOpcode == ISD::ZERO_EXTEND) // (zext (zext x)) -> (zext x) return getNode(ISD::ZERO_EXTEND, DL, VT, Operand.getNode()->getOperand(0)); + else if (OpOpcode == ISD::UNDEF) + // zext(undef) = 0, because the top bits will be zero. + return getConstant(0, VT); break; case ISD::ANY_EXTEND: assert(VT.isInteger() && Operand.getValueType().isInteger() && |