[PATCH] D141940: [SLP]Add shuffling of extractelements to avoid extra costs/data movement.

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Feb 4 13:19:02 PST 2023


RKSimon added a comment.

There's a lot going on in this patch - making it really difficult to understand



================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:630
+  // Restore unused scalars from mask.
+  for (int I = 0, E = GatheredExtracts.size(); I > E; ++I) {
+    auto *EI = dyn_cast<ExtractElementInst>(VL[I]);
----------------
I > E?


================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:6867
+        if ((VF == VF1 && GatheredScalars.size() != VF1) ||
+            (VF == VF2 && GatheredScalars.size() != VF2))
+          GatheredScalars.append(VF - GatheredScalars.size(),
----------------
we're looking for VF? == VF so would this be better as:
```
((VF == VF1 || VF == VF2) && GatheredScalars.size() != VF)
```


================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:9416
+        if ((VF == VF1 && GatheredScalars.size() != VF1) ||
+            (VF == VF2 && GatheredScalars.size() != VF2))
+          GatheredScalars.append(VF - GatheredScalars.size(),
----------------
```
((VF == VF1 || VF == Vf2) && GatheredScalars.size() != VF) 
```


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D141940/new/

https://reviews.llvm.org/D141940



More information about the llvm-commits mailing list