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

Press ? to show keyboard shortcuts.
Committed
friedgoldMar 25 2014, 10:21 AM
Differential Revision
D3117: [InstCombine] Don't fold bitcast into store if it would need addrspacecast
Parents
rL204732: Reuse earlier variables to make it clear the types involved in the cast.
Branches
Unknown
Tags
Unknown
Subscribers
None
Description

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

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.

CC: llvm-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D3117

rL204733

llvm/trunk/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp

Loading...

llvm/trunk/test/Transforms/InstCombine/bitcast-store.ll

Loading...

Add Comment