Fix a crasher when PerformShiftCombine receives a BUILD_VECTOR of all UNDEF. Probably...
authorCraig Topper <craig.topper@gmail.com>
Tue, 17 Jan 2012 04:44:50 +0000 (04:44 +0000)
committerCraig Topper <craig.topper@gmail.com>
Tue, 17 Jan 2012 04:44:50 +0000 (04:44 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148285 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/X86/X86ISelLowering.cpp

index b5198c8510f1fc4576c775032c5a5e2533c4fc70..a0fd4316c384a880421129e1a99b997f562f8377 100644 (file)
@@ -13430,6 +13430,11 @@ static SDValue PerformShiftCombine(SDNode* N, SelectionDAG &DAG,
       BaseShAmt = Arg;
       break;
     }
+    // Handle the case where the build_vector is all undef
+    // FIXME: Should DAG allow this?
+    if (i == NumElts)
+      return SDValue();
+
     for (; i != NumElts; ++i) {
       SDValue Arg = ShAmtOp.getOperand(i);
       if (Arg.getOpcode() == ISD::UNDEF) continue;