summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-04-10 04:33:08 +0000
committerChris Lattner <sabre@nondot.org>2005-04-10 04:33:08 +0000
commitf74c794ccfec7f9d7064d5181f7d5788661b2588 (patch)
tree888a40b86ef72a86033261e988efc3853e602c01 /llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
parentf2bff9241188b59e9ac3d11383d3af5547953565 (diff)
downloadbcm5719-llvm-f74c794ccfec7f9d7064d5181f7d5788661b2588.tar.gz
bcm5719-llvm-f74c794ccfec7f9d7064d5181f7d5788661b2588.zip
Fold zext_inreg(zextload), likewise for sext's
llvm-svn: 21204
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index 7cf89144c3b..6b94adf1d8e 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -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)
OpenPOWER on IntegriCloud