This is an archive of the discontinued LLVM Phabricator instance.

DAG: Add nuw when splitting loads and stores
ClosedPublic

Authored by arsenm on Oct 29 2017, 8:31 AM.

Details

Reviewers
bogner
Summary

The object can't straddle the address space
wrap around, so I think it's OK to assume any
offsets added to the base object pointer can't
overflow. Similar logic already appears to be
applied in SelectionDAGBuilder when lowering
aggregate returns. Overflow flags scare me
so I'm not sure. I'm not sure the best
way to test for these, but some of these
avoid AMDGPU test regressions in a future
commit.

It would probably make sense to introduce
a getAddNUW helper for this instead
of littering the same boilerplate around
to create the flags.

Diff Detail

Event Timeline

arsenm created this revision.Oct 29 2017, 8:31 AM

Looks right to me. Regarding a helper, the comment is longer than the code, so you should name the helper so that you can move the comment too. Maybe getObjectOffsetWrapFlags or similar.

arsenm updated this revision to Diff 121588.Nov 4 2017, 4:33 AM

Add helper and use in a few more places

arsenm updated this revision to Diff 121610.Nov 4 2017, 6:02 PM

Missed a few places

bogner accepted this revision.Nov 28 2017, 3:56 PM

Looks like you've addressed Hal's feedback, and this looks reasonable to me.

This revision is now accepted and ready to land.Nov 28 2017, 3:56 PM

Oh, please update the commit message to remove the bit about "we should add a helper" when you commit. You already did :)

arsenm closed this revision.Nov 28 2017, 5:25 PM

r319272