[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 15:24:36 PDT 2022


efriedma added a comment.

"readonly" really has to encompass memory visible to the whole unit of optimization (the current translation unit, plus any other translation units involved in LTO) to justify the way we reason about it. For example, suppose we have a function that's logically doesn't have any state, but it contains a mutable cache of results.  Then suppose we inline one call to it: now the "readonly" function touches state that matters to the caller.

"caller functions" is also a bit imprecise if callbacks are involved.

It might be possible to extend LLVM IR to define some memory as "internal" to some particular set of functions, and opaque to outside functions, but that currently doesn't exist.


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