[llvm] [SLP] Keep reassoc on the ordered fadd reduction when all ops allow it (PR #222479)

Dmitry Sidorov via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 10 02:12:14 PDT 2026


MrSidims wrote:

The ordered matcher is also used as a fallback when the ordinary reduction vectorization attempt fails. That fallback is not gated on the absence of `reassoc`. Specifically, `matchOrderedReduction()` rejects only `ReductionOrdering::None`, so it also accepts reassociable chains. It then explicitly sets `RK = Ordered` for the matched linear chain. Therefore, entering this path does not mean the original operations require ordered evaluation.

The testcase illustrates one reason for reaching this fallback. As the ordinary path skips its two undersized groups, while the fallback considers all four leaves together.

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


More information about the llvm-commits mailing list