[llvm-branch-commits] [llvm] [AArch64] Fold MIN/MAX(Vec[0], Vec[1]) to VECREDUCE_MIN/MAX(Vec) (PR #181162)

Benjamin Maxwell via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Feb 12 07:45:12 PST 2026


MacDue wrote:

I'm not saying that. I'm saying that I've been told before that folding to `vector.reduce.*` is less canonical (as the scalar code is easier to understand/more things recognize it). Neither is currently transformed into the other. 

Also, I'm not entirely sure it's a worthwhile debate, since it's just as easy to match in SelectionDAG as it is in IR (the same operations exit in both places). Note: Whether or not this is a worthwhile thing to do also seems target-dependent right now, as for example x86's codegen appears much worse for the `vector.reduce.*` variant https://godbolt.org/z/5PedMbddr, so would need fixing if the canonical form changed.

https://github.com/llvm/llvm-project/pull/181162


More information about the llvm-branch-commits mailing list