Page MenuHomePhabricator

[InstCombine] Don't fold bitcast into store if it would need addrspacecast
ClosedPublic

Authored by friedgold on Mar 19 2014, 6:11 AM.

Details

Summary

Previously the code didn't check if the before and after types for the
store were pointers to different address spaces. This resulted in
instcombine using a bitcast to convert between pointers to different
address spaces, causing an assertion due to the invalid cast.

It is not be appropriate to use addrspacecast this case because it is
not guaranteed to be a no-op cast. Instead bail out and do not do the
transformation.

Diff Detail

Event Timeline

friedgold updated this revision to Unknown Object (????).Mar 24 2014, 9:25 AM

Tidy up based on review comments.

Make use of getPointerAddressSpace(), separate out checks for the address space of the
pointer and the address space of the pointer the pointer points to.

OK to commit?

arsenm accepted this revision.Mar 24 2014, 12:17 PM

Putting the test below the metadata is kind of weird, but other than that LGTM

Closed by commit rL204733 (authored by @friedgold).