HomePhabricator

[nofree] Restrict semantics to memory visible to caller

Authored by reames on Apr 16 2021, 11:37 AM.

Description

[nofree] Restrict semantics to memory visible to caller

This patch clarifies the semantics of the nofree function attribute to make clear that it provides an "as if" semantic. That is, a nofree function is guaranteed not to free memory which existed before the call, but might allocate and then deallocate that same memory within the lifetime of the callee.

This is the result of the discussion on llvm-dev under the thread "Ambiguity in the nofree function attribute".

The most important part of this change is the LangRef wording. The rest is minor comment changes to emphasize the new semantics where code was accidentally consistent, and fix one place which wasn't consistent. That one place is currently narrowly used as it is primarily part of the ongoing (and not yet enabled) deref-at-point semantics work.

Differential Revision: https://reviews.llvm.org/D100141

Details

Committed
reamesApr 16 2021, 11:38 AM
Differential Revision
D100141: [nofree] Restrict semantics to memory visible to caller
Parents
rG0daf27302518: [Builtins] Add memory allocation builtins (PR12543)
Branches
Unknown
Tags
Unknown