[llvm] [LV] Vectorize selecting last IV of min/max element. (PR #141431)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 19 07:11:04 PST 2025
================
@@ -376,6 +383,9 @@ class RecurrenceDescriptor {
// Currently only a non-reassociative FAdd can be considered in-order,
// if it is also the only FAdd in the PHI's use chain.
bool IsOrdered = false;
+ // True if the reduction PHI has multiple in-loop users. This is relevant
+ // for min/max reductions that are part of a FindLastIV pattern.
+ bool IsPhiMultiUse = false;
----------------
fhahn wrote:
I updated it to the more verbose `PhiHasLoopUsesOutsideReductionChain`. WDYT?
> An argmax/argmin pattern where a min/max reduction feeds a FindLastIV reduction may be indicated with something like IsFeedingAnotherReduction - as opposed to feeding say a non-reducing in-loop store (cf. a cumulative-sum pattern where a sum reduction feeds a non-reducing in-loop store). But here the additional in-loop user(s) has yet to be analyzed if it's reducing or not?
Exactly, we delay checking the other users here, as it naturally will be handled by the existing analysis, and matching/legalization can easily be done in VPlan.
https://github.com/llvm/llvm-project/pull/141431
More information about the llvm-commits
mailing list