[clang] [llvm-profdata] Do not create numerical strings for MD5 function names read from a Sample Profile. (PR #66164)
    William Junda Huang via cfe-commits 
    cfe-commits at lists.llvm.org
       
    Mon Oct  9 14:37:23 PDT 2023
    
    
  
================
@@ -902,12 +890,16 @@ std::error_code SampleProfileReaderExtBinaryBase::readFuncProfiles() {
       for (const auto &NameOffset : FuncOffsetList) {
         const auto &FContext = NameOffset.first;
         auto FName = FContext.getName();
+        StringRef FNameString;
+        if (!useMD5()) {
+          FNameString = FName.stringRef(Buffer);
+        }
         // For function in the current module, keep its farthest ancestor
         // context. This can be used to load itself and its child and
         // sibling contexts.
-        if ((useMD5() && FuncGuidsToUse.count(std::stoull(FName.data()))) ||
-            (!useMD5() && (FuncsToUse.count(FName) ||
-                           (Remapper && Remapper->exist(FName))))) {
+        if ((useMD5() && FuncGuidsToUse.count(FName.getHashCode())) ||
+            (!useMD5() && (FuncsToUse.count(FNameString) ||
----------------
huangjd wrote:
If MD5 is not used, ProfileFuncRef should be a StringRef and the convert function should be zero cost. 
https://github.com/llvm/llvm-project/pull/66164
    
    
More information about the cfe-commits
mailing list