[PATCH] D35420: [OpenCL] Fix access qualifiers metadata for kernel arguments with typedef
Alexey Sotkin via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jul 18 03:26:34 PDT 2017
AlexeySotkin updated this revision to Diff 107044.
AlexeySotkin added a comment.
Changing case in the variable name
https://reviews.llvm.org/D35420
Files:
lib/CodeGen/CodeGenFunction.cpp
test/CodeGenOpenCL/kernel-arg-info.cl
Index: test/CodeGenOpenCL/kernel-arg-info.cl
===================================================================
--- test/CodeGenOpenCL/kernel-arg-info.cl
+++ test/CodeGenOpenCL/kernel-arg-info.cl
@@ -61,6 +61,21 @@
// CHECK-NOT: !kernel_arg_name
// ARGINFO: !kernel_arg_name ![[MD54:[0-9]+]]
+typedef read_only image1d_t ROImage;
+typedef write_only image1d_t WOImage;
+typedef read_write image1d_t RWImage;
+kernel void foo6(ROImage ro, WOImage wo, RWImage rw) {
+}
+// CHECK: define spir_kernel void @foo6{{[^!]+}}
+// CHECK: !kernel_arg_addr_space ![[MD61:[0-9]+]]
+// CHECK: !kernel_arg_access_qual ![[MD62:[0-9]+]]
+// CHECK: !kernel_arg_type ![[MD63:[0-9]+]]
+// CHECK: !kernel_arg_base_type ![[MD64:[0-9]+]]
+// CHECK: !kernel_arg_type_qual ![[MD65:[0-9]+]]
+// CHECK-NOT: !kernel_arg_name
+// ARGINFO: !kernel_arg_name ![[MD66:[0-9]+]]
+
+
// CHECK: ![[MD11]] = !{i32 1, i32 0, i32 0, i32 2, i32 1, i32 1}
// CHECK: ![[MD12]] = !{!"none", !"none", !"none", !"none", !"none", !"none"}
// CHECK: ![[MD13]] = !{!"int*", !"int", !"int", !"float*", !"int*", !"int*"}
@@ -87,3 +102,10 @@
// CHECK: ![[MD53]] = !{!"image1d_t", !"image1d_t"}
// ARGINFO: ![[MD54]] = !{!"img1", !"img2"}
+// CHECK: ![[MD61]] = !{i32 1, i32 1, i32 1}
+// CHECK: ![[MD62]] = !{!"read_only", !"write_only", !"read_write"}
+// CHECK: ![[MD63]] = !{!"ROImage", !"WOImage", !"RWImage"}
+// CHECK: ![[MD64]] = !{!"image1d_t", !"image1d_t", !"image1d_t"}
+// CHECK: ![[MD65]] = !{!"", !"", !""}
+// ARGINFO: ![[MD66]] = !{!"ro", !"wo", !"rw"}
+
Index: lib/CodeGen/CodeGenFunction.cpp
===================================================================
--- lib/CodeGen/CodeGenFunction.cpp
+++ lib/CodeGen/CodeGenFunction.cpp
@@ -620,7 +620,10 @@
// Get image and pipe access qualifier:
if (ty->isImageType()|| ty->isPipeType()) {
- const OpenCLAccessAttr *A = parm->getAttr<OpenCLAccessAttr>();
+ const Decl *PDecl = parm;
+ if (auto *TD = dyn_cast<TypedefType>(ty))
+ PDecl = TD->getDecl();
+ const OpenCLAccessAttr *A = PDecl->getAttr<OpenCLAccessAttr>();
if (A && A->isWriteOnly())
accessQuals.push_back(llvm::MDString::get(Context, "write_only"));
else if (A && A->isReadWrite())
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D35420.107044.patch
Type: text/x-patch
Size: 2232 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170718/423d5926/attachment-0001.bin>
More information about the cfe-commits
mailing list