[PATCH] D126939: [SLP] Avoid converting undef to poison when gathering.

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 3 15:04:22 PDT 2022


MaskRay accepted this revision.
MaskRay added a comment.
This revision is now accepted and ready to land.

Was the issue introduced by D103458 <https://reviews.llvm.org/D103458>?



================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:7564
     }
-    UniqueValues.append(VF - UniqueValues.size(),
-                        PoisonValue::get(VL[0]->getType()));
+    // Don't convert an undef to a poison while padding
+    for (Value *V : drop_begin(VL, VL.size() - (VF - UniqueValues.size()))) {
----------------



================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:7566
+    for (Value *V : drop_begin(VL, VL.size() - (VF - UniqueValues.size()))) {
+      Value *PaddingV = (isa<UndefValue>(V) && !isa<PoisonValue>(V))
+                            ? UndefValue::get(VL[0]->getType())
----------------
Note: I have tried `isa<PoisonValue>(V) ? PoisonValue::get(VL[0]->getType()) : UndefValue::get(VL[0]->getType())` but that seems to break a number of tests.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D126939



More information about the llvm-commits mailing list