[llvm] [MergeFuncs] Use sizeWithoutDebug to decide if we create a thunk (PR #68627)

Oskar Wirga via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 12 10:00:47 PDT 2023


oskarwirga wrote:

> I'm not convinced this is a good idea. This means you allow merging via thunk for functions that only have a single real instruction (apart from the return). This might minimize binary size, but introducing an extra call seems like a bad size/performance tradeoff for that case.

Sorry for overzealously landing before you had a chance to re-review. Without this change, I actually saw a binary size regression and I figured people opting in to function merging were seeking out minimal binary size. 

Before this change, we were inconsistent on how we merged functions. The test case I added was from a direct observation where I noticed we were merging functions like `f_thunk` that only contained a single return so with my change it is consistent behavior whether you compile with debug info or not while also providing better binary size than the previous inconsistent behavior. Now its no longer possible for a function of just `ret void` to be merged, but we will still merge where its profitable for binary size. 

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


More information about the llvm-commits mailing list