[llvm] [LV] Use shl for (VFxUF * vscale) when creating minimum iter check. (PR #153495)
Luke Lau via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 14 01:45:18 PDT 2025
================
@@ -2305,16 +2305,27 @@ Value *InnerLoopVectorizer::createIterationCountCheck(ElementCount VF,
Type *CountTy = Count->getType();
Value *CheckMinIters = Builder.getFalse();
auto CreateStep = [&]() -> Value * {
+ ElementCount VFTimesUF = VF.multiplyCoefficientBy(UF);
+ Value *VFxUF = nullptr;
+ if (!VFTimesUF.isScalable() ||
+ !isPowerOf2_64(VFTimesUF.getKnownMinValue())) {
+ VFxUF = createStepForVF(Builder, CountTy, VF, UF);
+ } else {
+ VFxUF = Builder.CreateShl(
+ Builder.CreateVScale(CountTy),
+ ConstantInt::get(CountTy, Log2_64(VFTimesUF.getKnownMinValue())), "",
+ true);
+ }
+
----------------
lukel97 wrote:
Can we move this into createStepForVF? `isPowerOf2_64(VFTimesUF.getKnownMinValue())` should be equivalent to `isPowerOf2_64(VF.getKnownMinValue()) && isPowerOf2_64(Step)`
https://github.com/llvm/llvm-project/pull/153495
More information about the llvm-commits
mailing list