[llvm] [LangRef] Mention allocation elision (PR #177592)
Ralf Jung via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 2 04:49:10 PST 2026
================
@@ -2077,6 +2077,15 @@ For example:
The first three options are mutually exclusive, and the remaining options
describe more details of how the function behaves. The remaining options
are invalid for "free"-type functions.
+
+ Calls to functions annotated with ``allockind`` are subject to allocation
+ elision: Calls to allocator functions can be removed, and the allocation
+ served from a virtual allocator instead. Notably, this is allowed even if
+ the allocator calls have side-effects.
+
+ If multiple allocation functions operate on the same allocation (for
+ example, an "alloc" followed by "free"), allocation elision is only allowed
+ if all involved functions have the same ``"alloc-family"``.
----------------
RalfJung wrote:
It has come up in a few papers, e.g. https://sf.snu.ac.kr/publications/ccr.pdf. But I don't know a canonical citation.
NB is basically the natural interpretation of what it means to do demonic non-deterministic choice over the empty set of possible options. (This is dual to how UB is angelic choice over the empty set.)
https://github.com/llvm/llvm-project/pull/177592
More information about the llvm-commits
mailing list