[llvm] [Inliner] Add cost model loop penalty for -Os. (PR #227042)

via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 28 09:58:09 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-analysis

Author: Alina Sbirlea (alinas)

<details>
<summary>Changes</summary>

In addition to having the loop penaly for -Oz build mode, add it to -Os as well. Both optimization modes should cosider size implication and avoid inlining inside loops.

The reduction seen in an internal test build with -Os goes from 200+s to negligible in LoopFullUnrollPass, due to avoiding inlining at ~4k callsites of a function with a small loop, inside a loop nest.

---
Full diff: https://github.com/llvm/llvm-project/pull/227042.diff


1 Files Affected:

- (modified) llvm/lib/Analysis/InlineCost.cpp (+2-2) 


``````````diff
The server is unavailable at this time. Please wait a few minutes before you try again.
``````````

</details>


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


More information about the llvm-commits mailing list