[PATCH] D144634: [Clang][OpenMP] Support for Code Generation of loop bind clause

Alexey Bataev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 11 07:35:55 PDT 2023


ABataev added inline comments.


================
Comment at: clang/lib/Sema/SemaOpenMP.cpp:6124
     BindKind = BC->getBindKind();
+
   // First check CancelRegion which is then used in checkNestingOfRegions.
----------------
Remove this new line


================
Comment at: clang/lib/Sema/SemaOpenMP.cpp:6181-6189
+      DSAStack->setCurrentDirective(OMPD_for);
+      break;
+    case OMPC_BIND_teams:
+      Kind = OMPD_distribute;
+      DSAStack->setCurrentDirective(OMPD_distribute);
+      break;
+    case OMPC_BIND_thread:
----------------
1. You're overriding the directive kind here and do not restore it then. It may cause the compiler crash.
2. I think you need to here to create a new OpenMP region rather than overriding the existing one.


================
Comment at: clang/test/OpenMP/loop_bind_codegen.cpp:1
+// Copyright 2020 Hewlett Packard Enterprise Development LP
+
----------------
Remove this


================
Comment at: clang/test/OpenMP/loop_bind_codegen.cpp:51-56
+void thread_loop2() {
+  #pragma omp loop bind(thread)
+  for (int j = 0 ; j < NNN ; j++) {
+    aaa[j] = j*NNN;
+  }
+}
----------------
I think it should trigger the assert in setCurrentDirective


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

https://reviews.llvm.org/D144634



More information about the cfe-commits mailing list