[llvm] [VPlan] Explicitly handle scalar pointer inductions. (PR #83068)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 22 01:22:52 PDT 2024
================
@@ -537,21 +540,54 @@ static VPValue *createScalarIVSteps(VPlan &Plan, const InductionDescriptor &ID,
VecPreheader->appendRecipe(Step->getDefiningRecipe());
}
- VPScalarIVStepsRecipe *Steps = new VPScalarIVStepsRecipe(ID, BaseIV, Step);
+ VPScalarIVStepsRecipe *Steps = new VPScalarIVStepsRecipe(
+ BaseIV, Step, InductionOpcode,
+ FPBinOp ? FPBinOp->getFastMathFlags() : FastMathFlags());
HeaderVPBB->insert(Steps, IP);
return Steps;
}
-/// If any user of a VPWidenIntOrFpInductionRecipe needs scalar values,
-/// provide them by building scalar steps off of the canonical scalar IV and
+/// Legalize VPWidenPointerInductionRecipe, by replacing it with a PtrAdd
+/// (IndStart, ScalarIVSteps (0, Step)) if only its scalar values are used, as
+/// VPWidenPointerInductionRecipe cannot generate scalars. Also optimize
----------------
ayalz wrote:
```suggestion
/// VPWidenPointerInductionRecipe will generate vectors only. Also optimize
```
So if scalar are used **along with vectors** of widen pointer induction, the former will be extracted from the latter; as opposed to widening int or fp inductions, where scalar users are fed scalar steps even if there are also vector users. Right?
https://github.com/llvm/llvm-project/pull/83068
More information about the llvm-commits
mailing list