[llvm] [MemProf] Suppress duplicate clones in the LTO backend (PR #161551)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 1 14:06:16 PDT 2025


================
@@ -5186,19 +5191,129 @@ bool CallsiteContextGraph<DerivedCCG, FuncTy, CallTy>::assignFunctions() {
   return Changed;
 }
 
+// Compute a SHA1 hash of the callsite and alloc version information of clone I
+// in the summary, to use in detection of duplicate clones.
+std::string ComputeHash(StringMap<Function *> &HashToFunc, FunctionSummary *FS,
----------------
kazutakahirata wrote:

May I suggest `const FunctionSummary *FS`?

```suggestion
std::string ComputeHash(StringMap<Function *> &HashToFunc, const FunctionSummary *FS,
```

Now, for the return value, I'm wondering if `uint64_t` is sufficient instead of the full 160-bit SHA1.  If you are OK with `uint64_t`, see the comment at the return statement below.


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


More information about the llvm-commits mailing list