This is an archive of the discontinued LLVM Phabricator instance.

SROA: Use correct address space when splitting loads (PR26154)
Needs ReviewPublic

Authored by hans on Apr 27 2017, 11:31 AM.

Details

Reviewers
chandlerc
Summary

escha reported this bug and proposed patch some time ago. Let's get it landed.

Diff Detail

Event Timeline

hans created this revision.Apr 27 2017, 11:31 AM
chandlerc requested changes to this revision.Apr 30 2017, 7:17 PM

This test case should be cleaned up and merged into SROA/address-spaces.ll. Also, if I delete the 'getPointerAddressSpace()` call on line 3701, no test fails, so we clearly need better tests for the address space manipulation code in this file, or the call on line 3701 is actually dead and it should be *replaced* with the load-based address space in this patch.

This revision now requires changes to proceed.Apr 30 2017, 7:17 PM
hans added a comment.May 1 2017, 3:28 PM

This test case should be cleaned up and merged into SROA/address-spaces.ll.

Done.

While doing that I ran into problems because the data layout in that file specifies 16 bits for pointers in address space 1, which means the GEPs into that address space need to use i16 for the offset. I've tried to fix that for the GEPs involed here.

Also, if I delete the 'getPointerAddressSpace()` call on line 3701, no test fails, so we clearly need better tests for the address space manipulation code in this file,

:-/

or the call on line 3701 is actually dead and it should be *replaced* with the load-based address space in this patch.

No, using the address space from the load for the store will not pass the verifier in this test.

I'm not very familiar with SROA, but this patch makes sense to me: if we cannot find an already split load, we create a new one, and we do it in the same way as we would originally have done up around line 3575, i.e. using the load instruction's address space.

hans updated this revision to Diff 97349.May 1 2017, 3:28 PM
hans edited edge metadata.

Cleaning up and moving test into address-spaces.ll.

jbhateja removed a subscriber: jbhateja.