[IR] Fix mayReadFromMemory() for writeonly calls
authorYevgeny Rouban <yevgeny.rouban@azul.com>
Mon, 21 Oct 2019 06:52:08 +0000 (06:52 +0000)
committerYevgeny Rouban <yevgeny.rouban@azul.com>
Mon, 21 Oct 2019 06:52:08 +0000 (06:52 +0000)
commit5e5af533ab16bad6dc5519b97b1820732d0141a5
tree54ed0353a335fbb9d82ed0db49e750066879e594
parentee881197b00186ada844ce0bb6969d6280a51775
[IR] Fix mayReadFromMemory() for writeonly calls

Current implementation of Instruction::mayReadFromMemory()
returns !doesNotAccessMemory() which is !ReadNone. This
does not take into account that the writeonly attribute
also indicates that the call does not read from memory.

The patch changes the predicate to !doesNotReadMemory()
that reflects the intended behavior.

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

llvm-svn: 375389
llvm/lib/IR/Instruction.cpp
llvm/test/CodeGen/AMDGPU/llvm.amdgcn.ds.gws.init.ll
llvm/test/Transforms/EarlyCSE/writeonly.ll [new file with mode: 0644]