[llvm] [TailCallElim] Improve cold function detection for SamplePGO (PR #218153)

Snehasish Kumar via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 22 15:33:20 PDT 2026


https://github.com/snehasish commented:

After looking at the code some more, I think `isFunctionColdInCallGraph` may not be the right direction. Sorry for the misleading comment on the prior PR.

Perhaps we can distinguish the missing-profile case rather than requiring isFunctionColdInCallGraph? BFI can't produce block counts without an entry count, and SampleProfileLoader normally sets one for profiled functions, so !F.getEntryCount() seems like a reasonable “unknown” case (and is what isFunctionHotnessUnknown uses for SamplePGO).

Would it make more sense to require that the caller hotness is known and then use `!isFunctionHotInCallGraph` instead? The invariant we're trying to preserve is that disabling the cold tail call must not impose frame overhead on hot code, rather than requiring every block in the function to itself meet the cold threshold.

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


More information about the llvm-commits mailing list