[llvm] [SLP] Allow non-power-of-2 VF in tryToVectorizeList (PR #206259)

Alexey Bataev via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 3 04:25:25 PDT 2026


================
@@ -28601,7 +28605,8 @@ bool SLPVectorizerPass::tryToVectorizeList(ArrayRef<Value *> VL, BoUpSLP &R,
     for (unsigned I = NextInst; I < MaxInst; ++I) {
       unsigned ActualVF = std::min(MaxInst - I, VF);
 
-      if (!hasFullVectorsOrPowerOf2(*TTI, ScalarTy, ActualVF))
+      if (!hasFullVectorsOrPowerOf2(*TTI, ScalarTy, ActualVF) &&
+          !isAllowedNonPowerOf2VF(ActualVF))
----------------
alexey-bataev wrote:

Single instruction is not useful, why do you think so? Non-power-of-2 vector factor, in general, should be tried only once. Here, we need to check, instead, that we can form at least several full vectors, not necessarily power-of-2 number of vectors, like check, that `ActualVF == getFloorFullVectorNumberOfElements(*TTI, ScalarTy, ActualVF)`, all other cases should be dropped

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


More information about the llvm-commits mailing list