[llvm] [SLSR] Adding a cost model considering register pressure (PR #213808)

Yoonseo Choi via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 11 23:32:11 PDT 2026


yoonseoch wrote:

> I'm excited to see that other folks are interested in making more passes RP aware! However, this heuristic feels too naive/brittle to me. What alternative designs do you have in mind?

It is quite a specific heuristic yet I feel it is still a practically valid starting point. When SLSR replaces a candidate with a basis plus delta, it naturally tends to increase the live range of the basis. That would be fine as replaced operands' live ranges are shorted in exchange and computations are simplified. This PR finds when the trade off doesn't happen by checking the replaced operands are still alive somewhere else. 

I do not have a clean alternative at this point. Perhaps, counting the number of replacement and the number of different basis instructions may be useful. If there are too many replacement within one basic block or a regions of basic blocks, it may point to "many concurrently live ranges". Even in that case, if a replacement completely shortens the live range of replaced operands in exchange to increased live ranges of basis, SLSR is not likely to increase live ranges in net effect. 

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


More information about the llvm-commits mailing list