[PATCH] D62299: [PR41567][Sema] Fixed cast kind in addr space conversions
Anastasia Stulova via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu May 23 03:30:18 PDT 2019
Anastasia created this revision.
Anastasia added a reviewer: rjmccall.
Herald added a subscriber: ebevhan.
This change sets missing cast kind correctly in the address space conversion case.
https://reviews.llvm.org/D62299
Files:
lib/Sema/SemaCast.cpp
test/CodeGenOpenCLCXX/addrspace-conversion.cl
Index: test/CodeGenOpenCLCXX/addrspace-conversion.cl
===================================================================
--- /dev/null
+++ 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: lib/Sema/SemaCast.cpp
===================================================================
--- lib/Sema/SemaCast.cpp
+++ lib/Sema/SemaCast.cpp
@@ -2428,6 +2428,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,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D62299.200920.patch
Type: text/x-patch
Size: 1040 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190523/7486de57/attachment-0001.bin>
More information about the cfe-commits
mailing list