[PATCH] D135863: [FunctionAttrs] Volatile operations can access inaccessible memory

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 13 03:24:35 PDT 2022


nikic created this revision.
nikic added reviewers: jdoerfert, reames, fhahn, efriedma.
Herald added subscribers: ormris, hiraditya.
Herald added a project: All.
nikic requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Per LangRef, volatile operations are allowed to access the location of their pointer argument, plus inaccessible memory:

> Any volatile operation can have side effects, and any volatile operation can read and/or modify state which is not accessible via a regular load or store in this module.
> [...]
> The allowed side-effects for volatile accesses are limited. If a non-volatile store to a given address would be legal, a volatile operation may modify the memory at that address. A volatile operation may not modify any other memory accessible by the module being compiled. A volatile operation may not call any code in the current module.

FunctionAttrs currently does not model this and ends up marking functions with volatile accesses on arguments as argmemonly, even though they should be inaccessiblemem_or_argmemonly.


https://reviews.llvm.org/D135863

Files:
  llvm/lib/Transforms/IPO/FunctionAttrs.cpp
  llvm/test/Transforms/FunctionAttrs/nosync.ll
  llvm/test/Transforms/FunctionAttrs/readattrs.ll
  llvm/test/Transforms/FunctionAttrs/writeonly.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D135863.467425.patch
Type: text/x-patch
Size: 4815 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221013/740e0c38/attachment.bin>


More information about the llvm-commits mailing list