[llvm] [FnSpecialization] Only accept codesize savings if strictly greater than the minimum amount (PR #164867)

Alexandros Lamprineas via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 24 01:09:15 PDT 2025


labrinea wrote:

> When MinCodeSizeSavings is set by default to 20, so if FuncSize < 5 all allowed by the knob, then MinCodeSizeSavings * FuncSize / 100 evaluates to 0. As a result, a CodeSizeSavings of 0 will pass this check and be possibly considered profitable.

20% is the bare minimum threshold (see https://github.com/llvm/llvm-project/blob/main/llvm/lib/Transforms/IPO/FunctionSpecialization.cpp#L72), you are now making it higher. With your change given MinCodeSizeSavings=25 and FuncSize=4 a specialization is not profitable, since MinCodeSizeSavings must be at least 50%.

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


More information about the llvm-commits mailing list