[llvm] [LV] Use shl for (VFxUF * vscale) when creating minimum iter check. (PR #153495)

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 14 07:38:12 PDT 2025


================
@@ -824,7 +824,15 @@ 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));
+  ElementCount VFxStep = VF.multiplyCoefficientBy(Step);
+  assert(isPowerOf2_64(VF.getKnownMinValue()) && "must pass power-of-2 VF");
+  if (VF.isScalable() && isPowerOf2_64(Step)) {
+    return B.CreateShl(
+        B.CreateVScale(Ty),
+        ConstantInt::get(Ty, Log2_64((VF * Step).getKnownMinValue())), "",
----------------
david-arm wrote:

Looks like it's not reusing `VFxStep` - I think it got lost from the previous commit.

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


More information about the llvm-commits mailing list