[llvm] [FnSpecialization] Enable function specialization of call chains (PR #163891)
Ryan Buchner via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 23 11:37:32 PDT 2025
bababuck wrote:
> > when specializing for the 3 passed to bar(), the value isn't propagated into foo() to gauge benefit from specializing foo() as well
>
> The function `InstCostVisitor::visitCallBase` tries to compute benefit from constant folding if possible. In this example it cannot constant fold `foo(3)` while propagating the constant inside bar's body. However given a small enough codesize threshold this example gets specialized: https://godbolt.org/z/dvfMov9WM
Agreed, thank you for the correction! My understanding is that `visitCallBase`, which calls `ConstantFolding.cpp::ConstandFoldCall` which to my understanding is targeted at intrinsics and library calls (please correct me if I'm wrong).
The example on Godbolt only specializes on the current upstream due to some funny behavior of the function specializer, see #164867 (this change is included in this MR as well, I have begun splitting off small chunks that can stand on their own).
https://github.com/llvm/llvm-project/pull/163891
More information about the llvm-commits
mailing list