InferAddressSpaces: Fix bug about replacing addrspacecast

InferAddressSpaces assumes the pointee type of addrspacecast
is the same as the operand, which is not always true and causes
invalid IR.

This bug cause build failure in HCC.

This patch fixes that.

Differential Revision: https://reviews.llvm.org/D39432


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316957 91177308-0d34-0410-b5e6-96231b3b80d8
2 files changed