Attribute for Function that does not write to memory that outlives itself

Hi all,

Is there a function attribute or otherwise way to query whether a function could write to memory that outlives itself?

For example writing to a global or memory passed in via a function argument would be writing to memory that outlives the function, but writing to a stack variable or allocation that isn’t returned would not.

Cheers,
Billy Moses

Pure or const are similar to what you want but not exactly the same to what you’re describing.

LLVM-IR: readnone/readonly/writeonly on functions is almost what you
want. They basically that from the perspective of the caller there is no
visible access/write/read.