[llvm] [SampleProfile] Support MD5-based ProfileSymbolList (PR #210235)

David Li via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 17 09:45:27 PDT 2026


================
@@ -1688,19 +1696,45 @@ class ProfileSymbolList {
     Syms.insert(Name.copy(Allocator));
   }
 
-  bool contains(StringRef Name) { return Syms.count(Name); }
+  bool contains(StringRef Name) const {
+    return Syms.count(Name) || ColdGUIDTable.contains(llvm::MD5Hash(Name));
+  }
 
   void merge(const ProfileSymbolList &List) {
+    assert(List.ColdGUIDTable.empty() &&
+           "Merging pre-hashed MD5 ProfileSymbolList not yet implemented");
     for (auto Sym : List.Syms)
       add(Sym, true);
   }
 
-  unsigned size() { return Syms.size(); }
+  unsigned size() const {
+    assert((ColdGUIDTable.empty() || Syms.empty()) &&
+           "Mixed string/GUID ProfileSymbolList size not yet implemented");
----------------
david-xl wrote:

should not support both? Even when they co-exist, strings should be used for different purpose and not for lookup.

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


More information about the llvm-commits mailing list