[PATCH] D158081: [IR] Add writable attribute

Ralf via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 17 00:54:07 PDT 2023


RalfJung added a comment.

> For that reason the writable attribute is specified to perform a spurious store of dereferenceable bytes on function entry.

That makes a lot of sense; FWIW I also don't know any better way to specify the regular `dereferenceable` attribute (i.e., as spurious reads). In particular those accesses are relevant for `noalias`. See here <https://github.com/rust-lang/unsafe-code-guidelines/issues/435> for me exploring this in the Rust context.

For this particular attribute however, just to be sure: it is still the responsibility of the optimization to ensure that the spuriously written value does not cause wrong results elsewhere, right? In other words, an empty function with a pointer argument that is 4-byte writeable can *not* just get a spurious store of `0`, since someone might actually look at that memory after the function returns and they would be able to see the difference?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D158081/new/

https://reviews.llvm.org/D158081



More information about the llvm-commits mailing list