[PATCH] D124124: [LangRef] Limit read/writeonly attrs to memory visible to caller
Eli Friedman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 20 22:47:44 PDT 2022
efriedma added a comment.
Oh, just took a look at D123473 <https://reviews.llvm.org/D123473>. I see what you're trying to do... yes, we should allow writing to memory that's allocated/deallocated within a function.
I think the only way to make the requirement here clear is to spell out the distinction between memory allocations that continue to be accessible after the function returns, vs. temporary memory allocations in the implementation. Maybe something like the following:
"We define 'local memory' to be memory that is allocated after entry to a function, deallocated before control flow returns to the caller. If a readonly function writes to memory that is not local memory, or has other side effects, the behavior is undefined."
(I'm not sure if we need to explicitly restrict accesses to local memory from other threads? I guess other threads don't have any way to construct a pointer to local memory, so that's probably okay.)
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D124124/new/
https://reviews.llvm.org/D124124
More information about the llvm-commits
mailing list