[llvm] [llvm-profgen] Filter out ambiguous cold profiles during profile generation (PR #81803)

via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 14 15:59:23 PST 2024


================
@@ -975,6 +975,8 @@ class FunctionSamples {
     return CallsiteSamples;
   }
 
+  CallsiteSampleMap &getCallsiteSamples() { return CallsiteSamples; }
----------------
WenleiHe wrote:

I remember we intentionally not exposing this as non-const (it was added once, and later cleaned up and removed). In generally we should be careful about exposing non-const accessor to private members. 

OTOH, I'm wondering do we actually need to filter call site (inlined) samples? I think only top level functions are indistinguishable, and inlinee's samples can be distinguished and still used by their inliner?

Also __cxx_global_var_init can inlined only into tls_init, but tls_ininit probably will never be inlined anywhere? 

If we really need to do this, it's probably better to use the const accessor and then cast away the constness, rather than adding an non-const API which is essentially saying it's expected to be modified in general and it's likely subject to misuse in the future.

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


More information about the llvm-commits mailing list