Fold zext_inreg(zextload), likewise for sext's

llvm-svn: 21204
This commit is contained in:
Chris Lattner 2005-04-10 04:33:08 +00:00
parent f2bff92411
commit f74c794ccf
1 changed files with 6 additions and 0 deletions

View File

@ -1101,6 +1101,12 @@ SDOperand SelectionDAG::getNode(unsigned Opcode, MVT::ValueType VT,SDOperand N1,
return N1;
}
// If we are (zero|sign) extending a [zs]extload, return just the load.
if ((N1.getOpcode() == ISD::ZEXTLOAD && Opcode == ISD::ZERO_EXTEND_INREG) ||
(N1.getOpcode() == ISD::SEXTLOAD && Opcode == ISD::SIGN_EXTEND_INREG))
if (cast<MVTSDNode>(N1)->getExtraValueType() <= EVT)
return N1;
// If we are extending the result of a setcc, and we already know the
// contents of the top bits, eliminate the extension.
if (N1.getOpcode() == ISD::SETCC)