[llvm] [IR] Introduce intrinsics to model allocator provenance semantics (PR #228048)
Antonio Frighetto via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 1 05:02:37 PDT 2026
================
@@ -320,6 +320,16 @@ static bool setAllocFamily(Function &F, StringRef Family) {
static bool setAllocKind(Function &F, AllocFnKind K) {
if (F.hasFnAttribute(Attribute::AllocKind))
return false;
+#if 0
+ // All library allocators inferred here are top-level heap allocators: their
+ // addresses are unpredictable and disjoint from allocas/globals. Likewise,
+ // deallocator routines poison the freed memory.
+ // TODO: Should this be inferred per function?
+ if ((K & (AllocFnKind::Alloc | AllocFnKind::Realloc)) != AllocFnKind::Unknown)
+ K |= AllocFnKind::AddressUnpredictable | AllocFnKind::AllocDisjoint;
+ if ((K & AllocFnKind::Free) != AllocFnKind::Unknown)
+ K |= AllocFnKind::PoisonsMemory;
+#endif
----------------
antoniofrighetto wrote:
This is a bit of a workaround, we probably need to set the flags explicitly per libfunc. This is to be landed separately in a follow-up PR (before DSE changes).
https://github.com/llvm/llvm-project/pull/228048
More information about the llvm-commits
mailing list