Index: cfe/trunk/lib/AST/ASTContext.cpp =================================================================== --- cfe/trunk/lib/AST/ASTContext.cpp +++ cfe/trunk/lib/AST/ASTContext.cpp @@ -7618,7 +7618,7 @@ Qualifiers RQuals = RHSCan.getLocalQualifiers(); if (LQuals != RQuals) { if (getLangOpts().OpenCL) { - if (LHS.getUnqualifiedType() != RHS.getUnqualifiedType() || + if (LHSCan.getUnqualifiedType() != RHSCan.getUnqualifiedType() || LQuals.getCVRQualifiers() != RQuals.getCVRQualifiers()) return QualType(); if (LQuals.isAddressSpaceSupersetOf(RQuals)) Index: cfe/trunk/test/CodeGenOpenCL/address-spaces-conversions.cl =================================================================== --- cfe/trunk/test/CodeGenOpenCL/address-spaces-conversions.cl +++ cfe/trunk/test/CodeGenOpenCL/address-spaces-conversions.cl @@ -63,7 +63,16 @@ // CHECK: %{{.+}} = addrspacecast i32 addrspace(1)* %{{.+}} to i32 addrspace(4)* // CHECK: phi // CHECK: store - + + typedef int int_t; + global int_t *var_glob_typedef; + var_gen = var_gen ? var_gen : var_glob_typedef; // operands of overlapping addr spaces and equivalent types + // CHECK: icmp + // CHECK-NOT: bitcast + // CHECK: %{{.+}} = addrspacecast i32 addrspace(1)* %{{.+}} to i32 addrspace(4)* + // CHECK: phi + // CHECK: store + var_gen_v = var_gen ? var_gen : var_gen_f; // operands of the same addr space and different types // CHECK: icmp // CHECK: %{{.+}} = bitcast i32 addrspace(4)* %{{.+}} to i8 addrspace(4)*