[llvm] [AllocToken] Introduce llvm.alloc.token.id intrinsic (PR #163632)

Florian Mayer via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 15 17:07:48 PDT 2025


================
@@ -140,9 +141,19 @@ STATISTIC(NumAllocationsInstrumented, "Allocations instrumented");
 ///
 /// Expected format is: !{<type-name>, <contains-pointer>}
 MDNode *getAllocTokenMetadata(const CallBase &CB) {
-  MDNode *Ret = CB.getMetadata(LLVMContext::MD_alloc_token);
-  if (!Ret)
-    return nullptr;
+  MDNode *Ret = nullptr;
+  if (auto *II = dyn_cast<IntrinsicInst>(&CB);
----------------
fmayer wrote:

hmm looking at this, it is a bit odd that we model this intrinsic the same way as a call to an allocator function. i guess that happens to work because we replace them all in this pass, otherwise we would be getting into trouble when also instrumenting NotLibFuncs, right?

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


More information about the llvm-commits mailing list