[llvm] [FuncSpec] Relax restrictions on code size growth (PR #196570)
via llvm-commits
llvm-commits at lists.llvm.org
Fri May 8 09:34:37 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-function-specialization
Author: Momchil Velikov (momchil-velikov)
<details>
<summary>Changes</summary>
This patch is a preparation for a follow-up patch which disables loop unroll in LTO pre-link pipeline, which affects code size and thus causes more functions to be rejected by the current code size growth restriction in function specialization.
---
Full diff: https://github.com/llvm/llvm-project/pull/196570.diff
2 Files Affected:
- (modified) llvm/lib/Transforms/IPO/FunctionSpecialization.cpp (+3-3)
- (modified) llvm/test/Transforms/FunctionSpecialization/recursive-penalty.ll (+1-1)
``````````diff
diff --git a/llvm/lib/Transforms/IPO/FunctionSpecialization.cpp b/llvm/lib/Transforms/IPO/FunctionSpecialization.cpp
index 1367940ad8ef8..c3963e28a09c4 100644
--- a/llvm/lib/Transforms/IPO/FunctionSpecialization.cpp
+++ b/llvm/lib/Transforms/IPO/FunctionSpecialization.cpp
@@ -63,9 +63,9 @@ static cl::opt<unsigned> MinFunctionSize(
cl::desc("Don't specialize functions that have less than this number of "
"instructions"));
-static cl::opt<unsigned> MaxCodeSizeGrowth(
- "funcspec-max-codesize-growth", cl::init(3), cl::Hidden, cl::desc(
- "Maximum codesize growth allowed per function"));
+static cl::opt<unsigned>
+ MaxCodeSizeGrowth("funcspec-max-codesize-growth", cl::init(4), cl::Hidden,
+ cl::desc("Maximum codesize growth allowed per function"));
static cl::opt<unsigned> MinCodeSizeSavings(
"funcspec-min-codesize-savings", cl::init(20), cl::Hidden,
diff --git a/llvm/test/Transforms/FunctionSpecialization/recursive-penalty.ll b/llvm/test/Transforms/FunctionSpecialization/recursive-penalty.ll
index fc17387dec94d..03eb8df046e5d 100644
--- a/llvm/test/Transforms/FunctionSpecialization/recursive-penalty.ll
+++ b/llvm/test/Transforms/FunctionSpecialization/recursive-penalty.ll
@@ -6,7 +6,7 @@
; Make sure the number of specializations created are not
; linear to the number of iterations (funcspec-max-iters).
-; CHECK: FnSpecialization: Created 4 specializations in module
+; CHECK: FnSpecialization: Created 6 specializations in module
@Global = internal constant i32 1, align 4
``````````
</details>
https://github.com/llvm/llvm-project/pull/196570
More information about the llvm-commits
mailing list