[llvm] [FuncSpec] Relax restrictions on code size growth (PR #196570)
Momchil Velikov via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 27 02:58:12 PDT 2026
https://github.com/momchil-velikov updated https://github.com/llvm/llvm-project/pull/196570
>From 8dc2f300b1d0fe7f74b85e314835f8efe362a185 Mon Sep 17 00:00:00 2001
From: Momchil Velikov <momchil.velikov at arm.com>
Date: Mon, 9 Feb 2026 14:11:17 +0000
Subject: [PATCH] [FuncSpec] Relax restrictions on code size growth
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.
---
llvm/lib/Transforms/IPO/FunctionSpecialization.cpp | 6 +++---
.../Transforms/FunctionSpecialization/recursive-penalty.ll | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/llvm/lib/Transforms/IPO/FunctionSpecialization.cpp b/llvm/lib/Transforms/IPO/FunctionSpecialization.cpp
index e36090ac0e387..13f4c932d99fb 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
More information about the llvm-commits
mailing list