[llvm] [VPlan] Update final IV exit value via VPlan. (PR #112147)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 15 12:05:03 PST 2025
================
@@ -666,6 +666,134 @@ static void legalizeAndOptimizeInductions(VPlan &Plan) {
}
}
+/// Return a wide IV, if \p VPV is an optimizable wide IV or wide IV use. That
+/// is, if \p VPV is either an untruncated wide induction, or if it increments a
+/// wide induction by its step.
+static VPWidenInductionRecipe *isOptimizableIVOrUse(VPValue *VPV) {
+ auto *WideIV = dyn_cast<VPWidenInductionRecipe>(VPV);
+ if (WideIV) {
+ // VPV itself is a wide induction, separately compute the end value for exit
+ // users if it is not a truncated IV.
+ if (isa<VPWidenPointerInductionRecipe>(WideIV) ||
+ !cast<VPWidenIntOrFpInductionRecipe>(WideIV)->getTruncInst())
+ return WideIV;
+ return nullptr;
+ }
+
+ // Check if VPV is an optimizable induction increment.
----------------
ayalz wrote:
Hmm, this is indeed confusing; should `fixHeaderPhis()` also hookup the operand across the backedge of induction header phi recipes, as it does for reductions and FORs? Thereby supporting its `VPHeaderPHIRecipe::getBackedgeValue()` API. Admittedly, this may contradict #82270(?)
https://github.com/llvm/llvm-project/pull/112147
More information about the llvm-commits
mailing list