[PATCH] D113774: [SLP]Improve splat detection.

Vasileios Porpodas via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 12 12:15:39 PST 2021


vporpo added inline comments.


================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:257
 
 /// \returns True if all of the values in \p VL are identical.
 static bool isSplat(ArrayRef<Value *> VL) {
----------------
Please update the comment to mention that this also accepts undefs.


================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:259
 static bool isSplat(ArrayRef<Value *> VL) {
-  for (unsigned i = 1, e = VL.size(); i < e; ++i)
-    if (VL[i] != VL[0])
+  Value *V = nullptr;
+  for (unsigned I = 0, E = VL.size(); I < E; ++I) {
----------------
NIT: Perhaps renaming `V` to something like `FirstNonUndef` would make this more readable.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D113774



More information about the llvm-commits mailing list