[PATCH] D62299: [PR41567][Sema] Fixed cast kind in addr space conversions

Phabricator via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 3 08:41:43 PDT 2019


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;
+}


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D62299.202730.patch
Type: text/x-patch
Size: 1136 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190603/5be16793/attachment.bin>


More information about the cfe-commits mailing list