[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


================
@@ -123,6 +126,31 @@ class UnrollState {
 };
 } // namespace
 
+void UnrollState::addStartIndexForScalarSteps(VPScalarIVStepsRecipe *Steps,
+                                              unsigned Part) {
+  if (Part == 0)
+    return;
+
+  VPBuilder Builder(Steps);
+  Type *BaseIVTy = TypeInfo.inferScalarType(Steps->getOperand(0));
+  Type *IntStepTy =
+      IntegerType::get(BaseIVTy->getContext(), BaseIVTy->getScalarSizeInBits());
+  VPValue *StartIndex = Steps->getVFValue();
+  StartIndex = Builder.createOverflowingOp(
+      Instruction::Mul,
+      {StartIndex,
+       Plan.getConstantInt(TypeInfo.inferScalarType(StartIndex), Part)});
----------------
ayalz wrote:

Can be placed under `if (Part > 1)`.

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


More information about the llvm-commits mailing list