This is an archive of the discontinued LLVM Phabricator instance.

[IR] Fix mayReadFromMemory() for writeonly calls
ClosedPublic

Authored by yrouban on Oct 16 2019, 11:51 PM.

Details

Summary

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 proposes to change the predicate to !doesNotReadMemory() that reflects the intended behavior.

Diff Detail

Event Timeline

yrouban created this revision.Oct 16 2019, 11:51 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 16 2019, 11:51 PM

Can this has test coverage?

yrouban updated this revision to Diff 225378.Oct 17 2019, 2:08 AM

Added a simple early-cse test.

yrouban updated this revision to Diff 225579.Oct 18 2019, 2:23 AM

Fixed llvm/test/CodeGen/AMDGPU/llvm.amdgcn.ds.gws.init.ll as Matt suggested

arsenm accepted this revision.Oct 18 2019, 10:35 AM

LGTM with minor test change

llvm/test/Transforms/EarlyCSE/writeonly.ll
8

I would loosen this to just CHECK-NOT: store in case of future IR syntax changes

This revision is now accepted and ready to land.Oct 18 2019, 10:35 AM
This revision was automatically updated to reflect the committed changes.