[llvm] [SLP] Loop aware cost model/tree building (PR #187391)
Alexey Bataev via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 13 14:07:38 PDT 2026
alexey-bataev wrote:
> It caused 30% regression to our eigen3 benchmark.
>
> The new code in function buildTreeRec limits a simple loop nest shape. But we have the following loop structure
>
> ```
> outer loop 1
> {
> inner loop 2
> {
> }
>
> inner loop 3
> {
> }
> }
> ```
>
> The vectorization candidate instructions are distributed in all 3 loops, because of the new limit, instructions from loop1 and loop2 are included, instructions from loop3 are discarded. And later it computes a non-profitable score, so scalar instructions are generated.
>
> In original implementation all vectorization candidate instructions(from loop1, loop2, loop3) are included, computes a profitable score, and generates vector instructions.
And that is expected, because these loops form 2 different loop nests (2-1 and 3-1, and the SLP tree cannot span across 2 different nests). Please, provide a reproducer for investigation, what can be improved.
https://github.com/llvm/llvm-project/pull/187391
More information about the llvm-commits
mailing list