[llvm] [LV] Consider whether vscale is a known power of two for iteration check (PR #144963)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 20 02:54:30 PDT 2025


================
@@ -2434,7 +2434,7 @@ Value *InnerLoopVectorizer::createIterationCountCheck(ElementCount VF,
       // check is known to be true, or known to be false.
       CheckMinIters = Builder.CreateICmp(P, Count, Step, "min.iters.check");
     } // else step known to be < trip count, use CheckMinIters preset to false.
-  } else if (VF.isScalable() &&
+  } else if (VF.isScalable() && !TTI->isVScaleKnownToBeAPowerOfTwo() &&
----------------
fhahn wrote:

I think this should hopefully be covered by tests using `-force-target-supports-scalable-vectors=true -scalable-vectorization=on` w/o target. @preames would be good to double check that's indeed the case before landing.

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


More information about the llvm-commits mailing list