summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
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
commit42603958fb850b95ab987bb547bb7347a0a75e74 (patch)
treead297e7df0acfa8025b5b147dd764313421fb17e /llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
parentfa6010b6e4c6f296c5dd99f9933223f16c3c1008 (diff)
downloadbcm5719-llvm-42603958fb850b95ab987bb547bb7347a0a75e74.tar.gz
bcm5719-llvm-42603958fb850b95ab987bb547bb7347a0a75e74.zip
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. llvm-svn: 104185
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index 347024f0ae4..0ea46af2acf 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/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)) {
OpenPOWER on IntegriCloud