]> granicus.if.org Git - llvm/commitdiff
[DAGCombiner] Make sure index of EXTRACT_SUBVECTOR is a constant before trying to...
authorCraig Topper <craig.topper@gmail.com>
Sun, 29 Jan 2017 04:38:16 +0000 (04:38 +0000)
committerCraig Topper <craig.topper@gmail.com>
Sun, 29 Jan 2017 04:38:16 +0000 (04:38 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293412 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/DAGCombiner.cpp

index 17608b1f0a5753522976f4975654138116f9b8ce..dc6b0b11c0f0e6841c11351f02321a70321984cb 100644 (file)
@@ -13884,15 +13884,15 @@ SDValue DAGCombiner::visitEXTRACT_SUBVECTOR(SDNode* N) {
   if (V.isUndef())
     return DAG.getUNDEF(NVT);
 
-  if (V->getOpcode() == ISD::CONCAT_VECTORS) {
-    // Combine:
-    //    (extract_subvec (concat V1, V2, ...), i)
-    // Into:
-    //    Vi if possible
-    // Only operand 0 is checked as 'concat' assumes all inputs of the same
-    // type.
-    if (V->getOperand(0).getValueType() != NVT)
-      return SDValue();
+  // Combine:
+  //    (extract_subvec (concat V1, V2, ...), i)
+  // Into:
+  //    Vi if possible
+  // Only operand 0 is checked as 'concat' assumes all inputs of the same
+  // type.
+  if (V->getOpcode() == ISD::CONCAT_VECTORS &&
+      isa<ConstantSDNode>(N->getOperand(1)) &&
+      V->getOperand(0).getValueType() == NVT) {
     unsigned Idx = N->getConstantOperandVal(1);
     unsigned NumElems = NVT.getVectorNumElements();
     assert((Idx % NumElems) == 0 &&