This revision was automatically updated to reflect the committed changes. Closed by commit rL362409: [PR41567][Sema] Fixed cast kind in addr space conversions (authored by stulova, committed by ). Herald added a project: LLVM. Herald added a subscriber: llvm-commits.
Changed prior to commit: https://reviews.llvm.org/D62299?vs=200920&id=202730#toc Repository: rL LLVM CHANGES SINCE LAST ACTION https://reviews.llvm.org/D62299/new/ https://reviews.llvm.org/D62299 Files: cfe/trunk/lib/Sema/SemaCast.cpp cfe/trunk/test/CodeGenOpenCLCXX/addrspace-conversion.cl Index: cfe/trunk/lib/Sema/SemaCast.cpp =================================================================== --- cfe/trunk/lib/Sema/SemaCast.cpp +++ cfe/trunk/lib/Sema/SemaCast.cpp @@ -2450,6 +2450,10 @@ tcr = TryAddressSpaceCast(Self, SrcExpr, DestType, /*CStyle*/ true, msg); if (SrcExpr.isInvalid()) return; + + if (isValidCast(tcr)) + Kind = CK_AddressSpaceConversion; + if (tcr == TC_NotApplicable) { // ... or if that is not possible, a static_cast, ignoring const, ... tcr = TryStaticCast(Self, SrcExpr, DestType, CCK, OpRange, msg, Kind, Index: cfe/trunk/test/CodeGenOpenCLCXX/addrspace-conversion.cl =================================================================== --- cfe/trunk/test/CodeGenOpenCLCXX/addrspace-conversion.cl +++ cfe/trunk/test/CodeGenOpenCLCXX/addrspace-conversion.cl @@ -0,0 +1,7 @@ +// RUN: %clang_cc1 %s -triple spir-unknown-unknown -cl-std=c++ -emit-llvm -O0 -o - | FileCheck %s + +void bar(__generic volatile unsigned int* ptr) +{ + //CHECK: addrspacecast i32 addrspace(4)* %{{.+}} to i32 addrspace(1)* + auto gptr = (__global volatile unsigned int*)ptr; +}
Index: cfe/trunk/lib/Sema/SemaCast.cpp =================================================================== --- cfe/trunk/lib/Sema/SemaCast.cpp +++ cfe/trunk/lib/Sema/SemaCast.cpp @@ -2450,6 +2450,10 @@ tcr = TryAddressSpaceCast(Self, SrcExpr, DestType, /*CStyle*/ true, msg); if (SrcExpr.isInvalid()) return; + + if (isValidCast(tcr)) + Kind = CK_AddressSpaceConversion; + if (tcr == TC_NotApplicable) { // ... or if that is not possible, a static_cast, ignoring const, ... tcr = TryStaticCast(Self, SrcExpr, DestType, CCK, OpRange, msg, Kind, Index: cfe/trunk/test/CodeGenOpenCLCXX/addrspace-conversion.cl =================================================================== --- cfe/trunk/test/CodeGenOpenCLCXX/addrspace-conversion.cl +++ cfe/trunk/test/CodeGenOpenCLCXX/addrspace-conversion.cl @@ -0,0 +1,7 @@ +// RUN: %clang_cc1 %s -triple spir-unknown-unknown -cl-std=c++ -emit-llvm -O0 -o - | FileCheck %s + +void bar(__generic volatile unsigned int* ptr) +{ + //CHECK: addrspacecast i32 addrspace(4)* %{{.+}} to i32 addrspace(1)* + auto gptr = (__global volatile unsigned int*)ptr; +}
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits