[llvm-branch-commits] [clang] [AllocToken, Clang] Implement TypeHashPointerSplit mode (PR #156840)
Marco Elver via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Fri Sep 26 13:40:19 PDT 2025
================
@@ -183,12 +201,20 @@ class TypeHashMode : public ModeBase {
using ModeBase::ModeBase;
uint64_t operator()(const CallBase &CB, OptimizationRemarkEmitter &ORE) {
+ const auto [N, H] = getHash(CB, ORE);
+ return N ? boundedToken(H) : H;
+ }
+
+protected:
+ std::pair<MDNode *, uint64_t> getHash(const CallBase &CB,
+ OptimizationRemarkEmitter &ORE) {
if (MDNode *N = getAllocTokenMetadata(CB)) {
MDString *S = cast<MDString>(N->getOperand(0));
- return boundedToken(xxHash64(S->getString()));
+ return {N, xxHash64(S->getString())};
----------------
melver wrote:
Yeah, xxHash64 appears to be stable but not defined to be. It's also used for KCFI for example.
However, I'd prefer something that has "stable" in it, so let's define getStableSipHash() which is what the ptrauth hash is based on: https://github.com/llvm/llvm-project/pull/160945
https://github.com/llvm/llvm-project/pull/156840
More information about the llvm-branch-commits
mailing list