This is an archive of the discontinued LLVM Phabricator instance.

[AMDGPU] Fix MMO for raw/struct buffer access with non-constant offset
ClosedPublic

Authored by foad on Jul 19 2021, 8:49 AM.

Details

Summary

Codegen for the raw/struct buffer access intrinsics would update the
offset in the MMO to reflect the combined offset, if it was known to be
constant. If the combined offset was not known to be constant, or if
there was an index, it would set the offset in the MMO to 0. This is
unsafe because it makes it look like the access does not alias with
another access with a fixed non-zero offset.

Fix these cases by setting the pointer in the MMO to null, to reflect
the fact that we do not have any known IR value pointer + constant
offset for the access.

Diff Detail

Event Timeline

foad created this revision.Jul 19 2021, 8:49 AM
foad requested review of this revision.Jul 19 2021, 8:49 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 19 2021, 8:49 AM
foad added a comment.Jul 19 2021, 8:51 AM

There are a few refactorings in here that I can commit separately if you'd prefer.

llvm/test/CodeGen/AMDGPU/buffer-schedule.ll
47

I can pre-commit this test case too.

foad updated this revision to Diff 360082.Jul 20 2021, 4:10 AM

Split NFC refactoring out into a separate patch.

This revision is now accepted and ready to land.Jul 21 2021, 1:18 PM