[llvm] [LV] Use shl for (VFxUF * vscale) when creating minimum iter check. (PR #153495)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 14 04:39:06 PDT 2025
================
@@ -824,7 +824,13 @@ namespace llvm {
Value *createStepForVF(IRBuilderBase &B, Type *Ty, ElementCount VF,
int64_t Step) {
assert(Ty->isIntegerTy() && "Expected an integer step");
- return B.CreateElementCount(Ty, VF.multiplyCoefficientBy(Step));
+ if (!VF.isScalable() || !isPowerOf2_64(VF.getKnownMinValue()) ||
+ !isPowerOf2_64(Step))
+ return B.CreateElementCount(Ty, VF.multiplyCoefficientBy(Step));
+
+ return B.CreateShl(
+ B.CreateVScale(Ty),
+ ConstantInt::get(Ty, Log2_64((VF * Step).getKnownMinValue())), "", true);
----------------
fhahn wrote:
Updated thanks
https://github.com/llvm/llvm-project/pull/153495
More information about the llvm-commits
mailing list