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
I feel like the AS check should be lifted here instead, because here we check unqualified types and then return LHS type. In OpenCL we have to return either LHS or RHS type just like you do below if AS overlap.