[llvm] [SLP]Allow matching and shuffling of extractelement vector operands with different VF. (PR #97414)

Alexey Bataev via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 2 09:28:21 PDT 2024


================
@@ -10679,11 +10667,11 @@ BoUpSLP::tryToGatherSingleRegisterExtractElements(
   SmallVector<Value *> GatheredExtracts(
       VL.size(), PoisonValue::get(VL.front()->getType()));
   if (SingleMax >= PairMax && SingleMax) {
-    for (int Idx : VectorOpToIdx[SingleVec])
+    for (int Idx : Vectors.front().second)
       std::swap(GatheredExtracts[Idx], VL[Idx]);
-  } else {
-    for (Value *V : {PairVec.first, PairVec.second})
-      for (int Idx : VectorOpToIdx[V])
+  } else if (!Vectors.empty()) {
+    for (unsigned Idx : {0, 1})
----------------
alexey-bataev wrote:

Because we checked SingleMax != 0 in the first condition, which is a guarantee Vectors is not empty. Here I can change the condition just to check that PairMax != 0 instead.

https://github.com/llvm/llvm-project/pull/97414


More information about the llvm-commits mailing list