[PATCH] D46667: [OpenCL, OpenMP] Fix crash when OpenMP used in OpenCL file

Anastasia Stulova via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 10 07:57:39 PDT 2018


Anastasia added inline comments.


================
Comment at: lib/Sema/SemaDecl.cpp:11348
     // initialiser
-    if (var->getTypeSourceInfo()->getType()->isBlockPointerType() &&
-        !var->hasInit()) {
+    if (var->getType()->isBlockPointerType() && !var->hasInit()) {
       Diag(var->getLocation(), diag::err_opencl_invalid_block_declaration)
----------------
ABataev wrote:
> Anastasia wrote:
> > Does `simd` result in block creation? My original understanding of it was that it will result in vector operations, not extra threads. 
> Currently all of the OpenMP constructs (even simd) create special lambda-like construct CapturedStmt that are kind of a block. It is required for unified processing of the OpenMP constructs. 
I see. It does add some extra code for captures and extra BBs but most of it seems to be removed with optimizations.


================
Comment at: test/SemaOpenCL/omp_simd.cl:1
+// RUN: %clang_cc1 -verify -fopenmp -fsyntax-only -x cl %s
+// expected-no-diagnostics
----------------
ABataev wrote:
> It would be good to check that at least -ast-print or -ast-dump works correctly. 
Generated IR seems fine. Might be enough to just convert to IR test?


Repository:
  rC Clang

https://reviews.llvm.org/D46667





More information about the cfe-commits mailing list