[llvm-commits] [llvm] r104185 - /llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Bob Wilson bob.wilson at apple.com
Wed May 19 16:42:58 PDT 2010


Author: bwilson
Date: Wed May 19 18:42:58 2010
New Revision: 104185

URL: http://llvm.org/viewvc/llvm-project?rev=104185&view=rev
Log:
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.

Modified:
    llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=104185&r1=104184&r2=104185&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Wed May 19 18:42:58 2010
@@ -6024,6 +6024,10 @@
   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)) {





More information about the llvm-commits mailing list