[llvm] [VPlan] Replace UnrollPart for VPScalarIVSteps with start index op (NFC) (PR #170906)

via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 18 13:34:36 PST 2026


================
@@ -2502,20 +2500,10 @@ void VPScalarIVStepsRecipe::execute(VPTransformState &State) {
     EndLane = StartLane + 1;
   }
   Value *StartIdx0;
-  if (getUnrollPart(*this) == 0)
-    StartIdx0 = ConstantInt::get(IntStepTy, 0);
-  else {
-    StartIdx0 = State.get(getOperand(2), true);
-    if (getUnrollPart(*this) != 1) {
-      StartIdx0 =
-          Builder.CreateMul(StartIdx0, ConstantInt::get(StartIdx0->getType(),
-                                                        getUnrollPart(*this)));
-    }
-    StartIdx0 = Builder.CreateSExtOrTrunc(StartIdx0, IntStepTy);
-  }
-
-  if (BaseIVTy->isFloatingPointTy())
-    StartIdx0 = Builder.CreateSIToFP(StartIdx0, BaseIVTy);
+  if (getNumOperands() == 3)
+    StartIdx0 = Constant::getNullValue(BaseIVTy);
+  else
----------------
ayalz wrote:

Alternative is to equip part 0 recipes with a StartIdx of zero, to simplify code-gen. (Analogous to representing a full mask by no mask at all, except here StartIdx is going to be AddOp'ed anyhow.)

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


More information about the llvm-commits mailing list