[llvm] [CodeLayout] Size-aware machine block placement (PR #109711)

via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 14 13:02:30 PDT 2024


spupyrev wrote:

Thanks for testing this out!

> and may even hurt compression ratio

Can you elaborate on this? I don't see a size regression in the provided example.

To clarify, this approach is intentionally designed to discard branch frequencies (ie the "0% probability") in order to get size wins, so I don't immediately see a "problem" here. The motivation is to get a better compression of cold functions, where non-perf-friendly layout isn't a concern.
We could potentially adjust the optimization so as it tries to respect certain branch probabilities, though it might result in less compressible code. Can you explain in more details the Swift use case and would one care about the placement of cold blocks?

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


More information about the llvm-commits mailing list