[llvm] [LV] Vectorize selecting last IV of min/max element. (PR #141431)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 9 14:46:19 PDT 2025
fhahn wrote:
> > So I think it should be detected independently. Of course, a better approach would be to first identify the recurrence chain, and then determine whether it's a reduction.
>
> Yep that's a good point! I was initially planning to split off detection of the pattern separately as follow-up, but it seems better to do it to start with. I started sharing a few refactoring patches to make it simpler to create reduction phi recipes in VPlan (final one in the series is #142322) and will update the PR here in the next few days.
Updated the latest version to perform the check for the pattern in VPlan.
The main idea is that we allow unclassified phis in legal and hand off the VPlan to check if we can the remaining VPWidenPHIRecipes to min/max reductions used by FindLast/FirstIV. The current patch just supports the FindLastIV case, to not make it depend on https://github.com/llvm/llvm-project/pull/140451.
It now depends on https://github.com/llvm/llvm-project/pull/142322 to make it easy to create VPReductionPHIRecipes from VPlan w/o RecurrenceDescriptor. WDYT?
https://github.com/llvm/llvm-project/pull/141431
More information about the llvm-commits
mailing list