[PATCH] D99611: [OPENMP]Fix PR48658: [OpenMP 5.0] Compiler crash when OpenMP atomic sync hints used.

Alexey Bataev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 31 12:59:09 PDT 2021


This revision was automatically updated to reflect the committed changes.
Closed by commit rG66da4f6fc9c1: [OPENMP]Fix PR48658: [OpenMP 5.0] Compiler crash when OpenMP atomic sync hints… (authored by ABataev).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99611

Files:
  clang/lib/CodeGen/CGStmtOpenMP.cpp
  clang/test/OpenMP/atomic_codegen.cpp


Index: clang/test/OpenMP/atomic_codegen.cpp
===================================================================
--- clang/test/OpenMP/atomic_codegen.cpp
+++ clang/test/OpenMP/atomic_codegen.cpp
@@ -58,7 +58,7 @@
       // CHECK: {{invoke|call}} void @_ZN2StD1Ev(%struct.St* {{[^,]*}} [[TEMP_ST_ADDR]])
 #pragma omp atomic
       St().get() %= b;
-#pragma omp atomic
+#pragma omp atomic hint(6)
       s.field++;
       // CHECK: invoke void @_ZN2StC1Ev(%struct.St* {{[^,]*}} [[TEMP_ST_ADDR:%.+]])
       // CHECK: [[SCALAR_ADDR:%.+]] = invoke nonnull align 4 dereferenceable(4) i32* @_ZN2St3getEv(%struct.St* {{[^,]*}} [[TEMP_ST_ADDR]])
Index: clang/lib/CodeGen/CGStmtOpenMP.cpp
===================================================================
--- clang/lib/CodeGen/CGStmtOpenMP.cpp
+++ clang/lib/CodeGen/CGStmtOpenMP.cpp
@@ -5594,7 +5594,11 @@
   case OMPC_exclusive:
   case OMPC_uses_allocators:
   case OMPC_affinity:
-  default:
+  case OMPC_init:
+  case OMPC_inbranch:
+  case OMPC_notinbranch:
+  case OMPC_link:
+  case OMPC_use:
     llvm_unreachable("Clause is not allowed in 'omp atomic'.");
   }
 }
@@ -5626,7 +5630,7 @@
         C->getClauseKind() != OMPC_acq_rel &&
         C->getClauseKind() != OMPC_acquire &&
         C->getClauseKind() != OMPC_release &&
-        C->getClauseKind() != OMPC_relaxed) {
+        C->getClauseKind() != OMPC_relaxed && C->getClauseKind() != OMPC_hint) {
       Kind = C->getClauseKind();
       break;
     }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D99611.334516.patch
Type: text/x-patch
Size: 1462 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210331/f8d6f418/attachment.bin>


More information about the cfe-commits mailing list