aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorBob Wilson <bob.wilson@apple.com>2010-05-19 23:42:58 +0000
committerBob Wilson <bob.wilson@apple.com>2010-05-19 23:42:58 +0000
commitc80cb51c8a4cfe1f0fade8b6d102c1cdd06ef6ee (patch)
treec2405612125a3f8241c34e9d0b52e81d3bf2dcd0 /lib
parent401bd5558a85c5510c50c3776f10f7f177ac3751 (diff)
downloadexternal_llvm-c80cb51c8a4cfe1f0fade8b6d102c1cdd06ef6ee.zip
external_llvm-c80cb51c8a4cfe1f0fade8b6d102c1cdd06ef6ee.tar.gz
external_llvm-c80cb51c8a4cfe1f0fade8b6d102c1cdd06ef6ee.tar.bz2
Optimize away insertelement of an undef value. This shows up in
test/Codegen/ARM/reg_sequence.ll but it doesn't affect the generated code because the coalescer cleans it up. Radar 7998853. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104185 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/CodeGen/SelectionDAG/DAGCombiner.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index 347024f..0ea46af 100644
--- a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -6024,6 +6024,10 @@ SDValue DAGCombiner::visitINSERT_VECTOR_ELT(SDNode *N) {
SDValue InVal = N->getOperand(1);
SDValue EltNo = N->getOperand(2);
+ // If the inserted element is an UNDEF, just use the input vector.
+ if (InVal.getOpcode() == ISD::UNDEF)
+ return InVec;
+
// If the invec is a BUILD_VECTOR and if EltNo is a constant, build a new
// vector with the inserted element.
if (InVec.getOpcode() == ISD::BUILD_VECTOR && isa<ConstantSDNode>(EltNo)) {