[llvm] [SLP] Enable full non-power-of-2 vectorization by default (PR #196825)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Wed May 13 03:09:22 PDT 2026


================
@@ -9984,8 +9995,13 @@ void BoUpSLP::tryToVectorizeGatheredLoads(
     SmallVector<std::pair<ArrayRef<Value *>, LoadsState>> Results;
     unsigned StartIdx = 0;
     SmallVector<int> CandidateVFs;
-    if (isAllowedNonPowerOf2VF(MaxVF))
-      CandidateVFs.push_back(MaxVF);
+    if (isAllowedNonPowerOf2VF(
+            MaxVF, isa<FixedVectorType>(Loads.front()->getType()))) {
+      const unsigned FullVectorNumElements = getFullVectorNumberOfElements(
+          *TTI, Loads.front()->getType(), MaxVF - 1);
+      if (MaxVF >= 3 && FullVectorNumElements != MaxVF - 1)
----------------
RKSimon wrote:

Another magic 3

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


More information about the llvm-commits mailing list