]> granicus.if.org Git - llvm/commitdiff
[X86][SSE] Don't call EltsFromConsecutiveLoads if any element is missing.
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Wed, 15 Feb 2017 21:09:00 +0000 (21:09 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Wed, 15 Feb 2017 21:09:00 +0000 (21:09 +0000)
Minor performance speedup - if any call to getShuffleScalarElt fails to get a result, don't both calling for the remaining elements as EltsFromConsecutiveLoads will fail anyhow.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295235 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/X86/X86ISelLowering.cpp

index 278c29f94d78af588b42dc0702ad5cbcdf91b3c7..3edfc98635a54c0cd0f5e7858649e207328bb480 100644 (file)
@@ -28360,11 +28360,18 @@ static SDValue combineShuffle(SDNode *N, SelectionDAG &DAG,
   // load4, <0, 1, 2, 3> into a 128-bit load if the load addresses are
   // consecutive, non-overlapping, and in the right order.
   SmallVector<SDValue, 16> Elts;
-  for (unsigned i = 0, e = VT.getVectorNumElements(); i != e; ++i)
-    Elts.push_back(getShuffleScalarElt(N, i, DAG, 0));
+  for (unsigned i = 0, e = VT.getVectorNumElements(); i != e; ++i) {
+    if (SDValue Elt = getShuffleScalarElt(N, i, DAG, 0)) {
+      Elts.push_back(Elt);
+      continue;
+    }
+    Elts.clear();
+    break;
+  }
 
-  if (SDValue LD = EltsFromConsecutiveLoads(VT, Elts, dl, DAG, true))
-    return LD;
+  if (Elts.size() == VT.getVectorNumElements())
+    if (SDValue LD = EltsFromConsecutiveLoads(VT, Elts, dl, DAG, true))
+      return LD;
 
   // For AVX2, we sometimes want to combine
   // (vector_shuffle <mask> (concat_vectors t1, undef)