[llvm] [AArch64] More accurately model cost of partial reductions (PR #181707)

Sander de Smalen via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 3 10:37:45 PDT 2026


sdesmalen-arm wrote:

> Hi. This is producing some strange results where I would not expect partial reductions to be used, or to be useful. Even on systems without dotprod we seem to be creating partial reductions in vplans, as if it always creates them even if they are not profitable compared to the alternative. There is an example in https://godbolt.org/z/WKef8MGPh where it generates less accumulators. Some other cases are even worse, even if it is not universally so.

Thanks for letting me know; reusing the same accumulator register adds a dependence that means partial reductions are less preferable. Now that #181706 has landed, we can set a higher cost for partial reductions when it can't be implemented with a specific (dot or top/bottom mla) instruction, so it will fall back to using a regular reduction. I'll share a patch for that next week.

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


More information about the llvm-commits mailing list