In codegen different address spaces may be mapped to the same address
space for a target, e.g. in x86/x86-64 all address spaces are mapped
to 0.
The following OpenCL C code
global int *a; generic void *b = a;
will generate AST like
`-ImplicitCastExpr '__generic void *' <AddressSpaceConversion> `-ImplicitCastExpr '__global int *' <LValueToRValue> `-DeclRefExpr '__global int *' lvalue Var 0x195157005e0 'a' '__global int *'
In codegen, both __generic and __global address spaces are mapped to 0.
If AddressSpaceConversion is mapped to addrspacecast, assertion will happen
since the source and target address spaces are the same.
The fix is to use CreatePointerBitCastOrAddrSpaceCast for translating
AddressSpaceConversion.
Differential Revision: http://reviews.llvm.org/D18713
This is just CreatePointerBitCastOrAddrSpaceCast.