[llvm] [SLP] Loop aware cost model/tree building (PR #187391)

via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 13 13:58:58 PDT 2026


weiguozhi 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.

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


More information about the llvm-commits mailing list