[all-commits] [llvm/llvm-project] f2fe28: [FunctionAttrs] Volatile operations can access ina...

Nikita Popov via All-commits all-commits at lists.llvm.org
Thu Oct 20 02:57:27 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f2fe289374b03d7a11559fa5ea2c6a0c225d0aec
      https://github.com/llvm/llvm-project/commit/f2fe289374b03d7a11559fa5ea2c6a0c225d0aec
  Author: Nikita Popov <npopov at redhat.com>
  Date:   2022-10-20 (Thu, 20 Oct 2022)

  Changed paths:
    M llvm/lib/Transforms/IPO/FunctionAttrs.cpp
    M llvm/test/Transforms/FunctionAttrs/nosync.ll
    M llvm/test/Transforms/FunctionAttrs/readattrs.ll
    M llvm/test/Transforms/FunctionAttrs/writeonly.ll

  Log Message:
  -----------
  [FunctionAttrs] Volatile operations can access inaccessible memory

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.

Differential Revision: https://reviews.llvm.org/D135863




More information about the All-commits mailing list