[PATCH] D144125: [VPlan] VPWidenIntOrFpInductionRecipe inherits from VPHeaderPHIRecipe
Ayal Zaks via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 7 13:38:12 PST 2023
Ayal added a comment.
This change makes a lot of sense, except for getBackedgeValue() - see comment.
================
Comment at: llvm/lib/Transforms/Vectorize/VPlan.h:1142-1143
+ /// Returns the step value of the induction.
+ VPValue *getStepValue() { return getOperand(1); }
+ const VPValue *getStepValue() const { return getOperand(1); }
+
----------------
Now that `VPWidenIntOrFpInductionRecipe` inherits from `VPHeaderPHIRecipe`, it also inherits `getBackedgeValue()`, which should return a VPValue defined by some recipe - `getBackedgeRecipe()` - **inside** the loop. The default returns `getOperand(1)`. However, `VPWidenIntOrFpInductionRecipe` has no such VPValue nor recipe to return because it takes care of generating the corresponding IR code only during execution. Better override `getBackedgeValue()` and `getBackedgeRecipe()`, asserting they are unreachable/never called?
(`Step` which here serves as operand 1 instead is a value defined by a recipe in the loop preheader or constant - not a recipe.)
================
Comment at: llvm/lib/Transforms/Vectorize/VPlan.h:1147-1152
+ TruncInst *getTruncInst() {
+ return Trunc;
+ }
+ const TruncInst *getTruncInst() const {
+ return Trunc;
+ }
----------------
nit: these should now be one liners.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D144125/new/
https://reviews.llvm.org/D144125
More information about the llvm-commits
mailing list