[llvm] [LangRef] Mention allocation elision (PR #177592)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 11 04:01:23 PST 2026
================
@@ -2077,6 +2077,19 @@ 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. In other words, for each allocation
+ there there is a non-deterministic choice between calling the allocator as
+ usual, or using a virtual, side-effect-free allocator instead.
----------------
nikic wrote:
Yes, in a specific sense. It is okay to elide *all* of the allocator side effects. But if the allocation is not elided, we also can't ignore the side effects.
https://github.com/llvm/llvm-project/pull/177592
More information about the llvm-commits
mailing list