[PATCH] D148010: [Pipelines] Don't run module optimization in full LTO pre-link

Nathan Lanza via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 26 15:17:33 PDT 2023


lanza added a comment.

> I evaluated this patch as-is and it was a considerable size regression (526 KiB for Facebook for Android arm64). However, my colleague @lanza discovered that adding additional instances of the function merging pass (here, here, and here), in addition to being a considerable size improvement by itself, also makes this change be a small size improvement (20 KiB) instead. We haven't upstreamed the additional function merger runs yet (we want to make sure we understand the size improvements properly and have a principled reason for the change), but I figured I'd note it here early in case someone else is also evaluating this for size.

To add a bit more detail here: we believe that the reason for this patch causing a regression (for us) is that running the function merging pass before LTO inlining (e.g. in the module optimization pipeline at the end of LTOprelink) causes a set of internal functions to become `true` for `hasOneUse()`. Thus the inliner will then boost the inline threshold <https://github.com/llvm/llvm-project/blob/main/llvm/lib/Analysis/InlineAdvisor.cpp#L279>, inline these functions, simplify them and generate size savings.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D148010/new/

https://reviews.llvm.org/D148010



More information about the llvm-commits mailing list