This is an archive of the discontinued LLVM Phabricator instance.

AMDGPU: Don't use MUBUF vaddr if address may overflow
ClosedPublic

Authored by arsenm on Nov 7 2017, 5:41 AM.

Details

Summary

Effectively revert r263964. Before we would not
allow this if vaddr was not known to be positive.
Extend this by also using nuw to see if the
computation will do an unsigned overflow, which is
what the addressing mode doesn't really support.

This is a strange use of nuw, but I think it's correct if I understand the MUBUF restriction correctly.
I think the issue is the total overflow of vaddr+soffset+offset, but I think the soffset component can be ignored.

Diff Detail

Event Timeline

arsenm created this revision.Nov 7 2017, 5:41 AM
rampitec added inline comments.Nov 7 2017, 10:00 AM
lib/Target/AMDGPU/SIISelLowering.cpp
176

How does LowerOperation work without this?

test/CodeGen/AMDGPU/amdgpu.private-memory.ll
395

It looks like regression to me.

arsenm updated this revision to Diff 122914.Nov 14 2017, 2:23 PM

Don't rely on NUW. Even if it's -1 + 0, the final add of soffset will overflow

lib/Target/AMDGPU/SIISelLowering.cpp
176

This isn't custom lowered, this is leftover junk.

test/CodeGen/AMDGPU/amdgpu.private-memory.ll
395

Yes, this is the point. This needs to be more conservative

This revision is now accepted and ready to land.Nov 14 2017, 3:03 PM
arsenm closed this revision.Nov 14 2017, 4:46 PM

r318240