[llvm] [StableHash] Implement stable global name for the hash computation (PR #106156)
Kyungwoo Lee via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 27 13:55:17 PDT 2024
================
@@ -50,6 +50,22 @@ inline stable_hash stable_hash_combine(stable_hash A, stable_hash B,
return stable_hash_combine(Hashes);
}
+// Removes suffixes introduced by LLVM from the name to enhance stability and
+// maintain closeness to the original name across different builds.
+inline StringRef get_stable_name(StringRef Name) {
+ auto [P1, S1] = Name.rsplit(".llvm.");
+ auto [P2, S2] = P1.rsplit(".__uniq.");
+ return P2;
+}
----------------
kyulee-com wrote:
Yes, the code segments appear similar, but they could be implied slightly differently depending on the client. Specifically, in this instance, I am planning to further extend the functionality for the upcoming global outlining feature -- https://github.com/llvm/llvm-project/pull/90074. I intend to introduce an additional suffix `.content.{number}` to the outlined function names, which will enable us to deduce the identities of target functions even when their names vary -- in that case, use the content hash from the suffix, rather than ignoring it . So, I think the usage here is primarily focused on accurately identifying the stable target based on the name.
https://github.com/llvm/llvm-project/pull/106156
More information about the llvm-commits
mailing list