Eliminate unneeded extensions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19577 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2005-01-16 00:17:20 +00:00
parent 8b6fa22e72
commit 950aa3ca2c

View File

@ -855,6 +855,15 @@ SDOperand SelectionDAG::getNode(unsigned Opcode, MVT::ValueType VT,SDOperand N1,
"Cannot *_EXTEND_INREG FP types");
if (EVT == VT) return N1; // Not actually extending
assert(EVT < VT && "Not extending!");
// If we are sign extending an extension, use the original source.
if (N1.getOpcode() == ISD::ZERO_EXTEND_INREG ||
N1.getOpcode() == ISD::SIGN_EXTEND_INREG) {
if (N1.getOpcode() == Opcode &&
cast<MVTSDNode>(N1)->getExtraValueType() <= EVT)
return N1;
}
break;
}