[llvm] [SLP] Initial vectorization of non-power-of-2 ops. (PR #77790)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 5 11:50:00 PDT 2024


================
@@ -14798,14 +14843,23 @@ bool SLPVectorizerPass::vectorizeStores(ArrayRef<StoreInst *> Stores,
         continue;
       }
 
+      std::optional<unsigned> NonPowerOf2VF;
+      if (VectorizeNonPowerOf2) {
+        // First try vectorizing with a non-power-of-2 VF. At the moment, only
+        // consider cases where VF + 1 is a power-of-2, i.e. almost all vector
+        // lanes are used.
+        unsigned CandVF = Operands.size();
+        if (isPowerOf2_32(CandVF + 1) && CandVF <= MaxVF) {
+          NonPowerOf2VF = CandVF;
+        }
----------------
fhahn wrote:

Done, thanks!

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


More information about the llvm-commits mailing list