[llvm] [SLSR] Adding a cost model considering register pressure (PR #213808)
Igor Wodiany via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 13 03:13:29 PDT 2026
https://github.com/IgWod commented:
Code looks good in general. I left few small comments. I'm still not convinced about using distance between IR instructions -- the ordering at this stage is somehow arbitrary. The code in your test could equally be written as:
```llvm
entry:
%t1 = add i32 %b, %s
%s2 = shl i32 %s, 1
%t2 = add i32 %b, %s2
call void @foo(i32 %t2)
call void @foo(i32 %t1)
call void @foo(i32 %b)
call void @foo(i32 %b)
call void @foo(i32 %b)
br label %next
next:
call void @use(i32 %s2)
ret void
}
```
And this completely changes the distance. The heuristic only works because the code was generated and kept in a specific order before SLSR is run but in general it's not necessary.
https://github.com/llvm/llvm-project/pull/213808
More information about the llvm-commits
mailing list