[PATCH] D143849: [Clang][OpenCL] Allow pointers in structs as kernel arguments from 2.0

Anastasia Stulova via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Feb 12 13:18:43 PST 2023


Anastasia added a comment.

I feel that originally pointers were disallowed because they create the same issue as `size_t` and etc as their size is implementation depended but the same logic applies to images and other types that are even more implementation depended. Overall this bit of the spec is very inconsistent so I don't mind if we change the behavior to be whatever we find more helpful. However I would encourage to submit an issue to OpenCL-Docs to point out this inconsistency.



================
Comment at: clang/lib/Sema/SemaDecl.cpp:9493
+      // union. This restriction was lifted in OpenCL v2.0 with the introduction
+      // of SVM.
+      if (S.getLangOpts().getOpenCLCompatibleVersion() > 120 &&
----------------
To be honest I feel like it was a bug fix? Do you happen to have any record of the fix?


================
Comment at: clang/lib/Sema/SemaDecl.cpp:9494
+      // of SVM.
+      if (S.getLangOpts().getOpenCLCompatibleVersion() > 120 &&
+          (ParamType == PtrKernelParam || ParamType == PtrPtrKernelParam))
----------------
I think it should be possible to merge this with `if` below to avoid condition duplication.




Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D143849/new/

https://reviews.llvm.org/D143849



More information about the cfe-commits mailing list