[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
================
@@ -95,6 +100,19 @@ LLVM_ABI Value *getFreedOperand(const CallBase *CB,
/// insertion or speculative execution of allocation routines.
LLVM_ABI bool isRemovableAlloc(const CallBase *V, const TargetLibraryInfo *TLI);
+/// Return true if \p V is a call to an allocation function whose returned
+/// address is unpredictable to the caller, so that comparisons of the address
+/// with pointers not based on the allocation may be folded (e.g., known
+/// allocators and routines annotated as allockind("address_unpredictable")).
+LLVM_ABI bool isAddressUnpredictableAlloc(const Value *V,
+ const TargetLibraryInfo *TLI);
+
+/// Return true if \p V is a call to an allocation function whose returned
+/// allocation is known not to overlap allocas, globals, byval arguments or
+/// other allocations (e.g., known allocators and routines annotated as
+/// allockind("alloc_disjoint")).
+LLVM_ABI bool isDisjointAlloc(const Value *V, const TargetLibraryInfo *TLI);
----------------
antoniofrighetto wrote:
This adds the new helpers, though I was planning support for InstSimplify/InstCombine in a follow-up PR, if that makes sense (may as well add it here though).
https://github.com/llvm/llvm-project/pull/228048
More information about the llvm-commits
mailing list