summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-01-16 00:17:20 +0000
committerChris Lattner <sabre@nondot.org>2005-01-16 00:17:20 +0000
commit0fe7776da5d5c3f63c03d6bf5a01d293da5f73d3 (patch)
tree9d208458573bddf0986272ac3a3b0896cd332ba9 /llvm/lib/CodeGen
parent4d97864e927a2cf9fadbb78503507a74ed72d03a (diff)
downloadbcm5719-llvm-0fe7776da5d5c3f63c03d6bf5a01d293da5f73d3.tar.gz
bcm5719-llvm-0fe7776da5d5c3f63c03d6bf5a01d293da5f73d3.zip
Eliminate unneeded extensions.
llvm-svn: 19577
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index 89c53e8c1ba..d3d44a82e08 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -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;
}
OpenPOWER on IntegriCloud