fix a case where all operands of BUILD_VECTOR are undefined
authorMichael Liao <michael.liao@intel.com>
Mon, 20 Aug 2012 17:59:18 +0000 (17:59 +0000)
committerMichael Liao <michael.liao@intel.com>
Mon, 20 Aug 2012 17:59:18 +0000 (17:59 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162214 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/X86/X86ISelLowering.cpp
test/CodeGen/X86/pr11334.ll

index e4af736844b3085f68625d0a7eeff00247fb93f5..1bbd4a76406a7b875b761c855fb0f6915296255f 100644 (file)
@@ -5180,6 +5180,10 @@ X86TargetLowering::LowerVectorFpExtend(SDValue &Op, SelectionDAG &DAG) const {
     Mask.push_back(cast<ConstantSDNode>(L2In.getOperand(1))->getZExtValue());
   }
 
     Mask.push_back(cast<ConstantSDNode>(L2In.getOperand(1))->getZExtValue());
   }
 
+  // Quit if all operands of BUILD_VECTOR are undefined.
+  if (!VecIn.getNode())
+    return SDValue();
+
   // Fill the remaining mask as undef.
   for (unsigned i = NumElts; i < VecInVT.getVectorNumElements(); ++i)
     Mask.push_back(-1);
   // Fill the remaining mask as undef.
   for (unsigned i = NumElts; i < VecInVT.getVectorNumElements(); ++i)
     Mask.push_back(-1);
index 5b7b5eab87ece41d56bd2abf37507774ab2e0457..e7e29e0d609cf6da05baf742e1755389da1bbf17 100644 (file)
@@ -54,3 +54,11 @@ entry:
   %f1 = fpext <8 x float> %v1 to <8 x double>
   ret <8 x double> %f1
 }
   %f1 = fpext <8 x float> %v1 to <8 x double>
   ret <8 x double> %f1
 }
+
+define void @test_vector_creation() nounwind {
+  %1 = insertelement <4 x double> undef, double 0.000000e+00, i32 2
+  %2 = load double addrspace(1)* null
+  %3 = insertelement <4 x double> %1, double %2, i32 3
+  store <4 x double> %3, <4 x double>* undef
+  ret void
+}