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

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