[PATCH] D112230: [OpenCL] Add support of __opencl_c_device_enqueue feature macro.

Anastasia Stulova via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 24 07:18:13 PST 2021


Anastasia added inline comments.


================
Comment at: clang/lib/AST/ExprConstant.cpp:9554
+
+    const auto &OpenCLFeaturesMap =
+        Info.Ctx.getTargetInfo().getSupportedOpenCLOpts();
----------------
azabaznov wrote:
> azabaznov wrote:
> > Anastasia wrote:
> > > What test case covers this change? It feels like something we should try to diagnose earlier...
> > The test case which exactly was added. Since blocks in constant address space are disallowed at this point, we can treat all other blocks with no captures not as constant expressions - it will make CodeGen generate block  literal in local scope for blocks with no captures. See `buildGlobalBlock `and `CodeGenModule::GetAddrOfGlobalBlock` for details.
> I mean - //blocks_no_global_literal.cl// - that's exactly the case which covers it.
Ok I see, it doesn't seem to have any constant but my guess is that it becomes constant implicitly?

Does the case with program scope variable supported need testing too or is it covered elsewhere?


================
Comment at: clang/lib/Sema/Sema.cpp:328
+    auto OCLCompatibleVersion = getLangOpts().getOpenCLCompatibleVersion();
+    if (OCLCompatibleVersion >= 200) {
+      if ((OCLCompatibleVersion == 200) ||
----------------
I wonder if we should simplify this condition by only checking `getLangOpts().Blocks` but then we make sure to set it correctly based on the language version and the target just like we do now for generic address space or pipes?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112230



More information about the cfe-commits mailing list