[llvm] [LV] Vectorize selecting index of min/max element. (PR #141431)
Mel Chen via llvm-commits
llvm-commits at lists.llvm.org
Mon May 26 03:05:41 PDT 2025
https://github.com/Mel-Chen commented:
I think it's a good idea that this patch avoids introducing a new RecurKind specifically for min/max with index.
However, I believe it would be more appropriate not to reuse AddReductionVars when idiom detection. The scalar phi for min/max doesn't really align with the current definition of a reduction. A reduction phi shouldn't be used by operations inside the loop that are not part of the recurrence chain, and it also needs to have users outside the loop.
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.
Here's the source code we use for the detection part: https://github.com/llvm/llvm-project/pull/141467
As for the IR generation, I'd like to keep it internal for a while longer to test things before releasing it.
https://github.com/llvm/llvm-project/pull/141431
More information about the llvm-commits
mailing list