Generates addrcast instead of bitcast for ternary operator when necessary, and diagnose ternary operator with incompatible second and third operands according to OpenCL v2.0 s6.5.6.
https://llvm.org/bugs/show_bug.cgi?id=19957
Differential Revision: http://reviews.llvm.org/D17412
We should add !OpenCL here. Because for OpenCL this check is wrong to do.
But I am not sure whether we need to add an OpenCL check here though, as we don't seem to return any type but void for OpenCL after this statement anyways.
However, we might return 'generic void*' if AS overlap, instead of 'private void*' as we do now. Would this make more sense?