[llvm] [MemProf][NFC] Correct comment about stripping of suffixes in profile (PR #73840)

Teresa Johnson via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 29 10:26:26 PST 2023


https://github.com/teresajohnson created https://github.com/llvm/llvm-project/pull/73840

The comment about the stripping of suffixes when creating the indexed
MemProf profile was partially incorrect, as we do not strip ".__uniq."
suffixes by default (by design). Update the comment accordingly.


>From 361677e72c71fef28c1438de750c6bbed96af348 Mon Sep 17 00:00:00 2001
From: Teresa Johnson <tejohnson at google.com>
Date: Wed, 29 Nov 2023 10:23:53 -0800
Subject: [PATCH] [MemProf][NFC] Correct comment about stripping of suffixes in
 profile

The comment about the stripping of suffixes when creating the indexed
MemProf profile was partially incorrect, as we do not strip ".__uniq."
suffixes by default (by design). Update the comment accordingly.
---
 llvm/lib/ProfileData/MemProf.cpp | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/llvm/lib/ProfileData/MemProf.cpp b/llvm/lib/ProfileData/MemProf.cpp
index db34de704a3c325..0461f0e9f840789 100644
--- a/llvm/lib/ProfileData/MemProf.cpp
+++ b/llvm/lib/ProfileData/MemProf.cpp
@@ -76,10 +76,12 @@ IndexedMemProfRecord::deserialize(const MemProfSchema &Schema,
 }
 
 GlobalValue::GUID IndexedMemProfRecord::getGUID(const StringRef FunctionName) {
-  // Canonicalize the function name to drop suffixes such as ".llvm.", ".uniq."
-  // etc. We can then match functions in the profile use phase prior to the
-  // addition of these suffixes. Note that this applies to both instrumented and
-  // sampled function names.
+  // Canonicalize the function name to drop suffixes such as ".llvm.". Note
+  // we do not drop any ".__uniq." suffixes, as getCanonicalFnName does not drop
+  // those by default. This is by design to differentiate internal linkage
+  // functions during matching. By dropping the other suffixes we can then match
+  // functions in the profile use phase prior to their addition. Note that this
+  // applies to both instrumented and sampled function names.
   StringRef CanonicalName =
       sampleprof::FunctionSamples::getCanonicalFnName(FunctionName);
 



More information about the llvm-commits mailing list