[Openmp-commits] [openmp] a7ac0dd - [NFC][OpenMP] Use `SimpleVLA` to replace variable length arrays in C++

Shilei Tian via Openmp-commits openmp-commits at lists.llvm.org
Tue Mar 26 21:24:01 PDT 2024


Author: Shilei Tian
Date: 2024-03-27T00:23:32-04:00
New Revision: a7ac0dd624962de1ccb55f1ed1357f548477f593

URL: https://github.com/llvm/llvm-project/commit/a7ac0dd624962de1ccb55f1ed1357f548477f593
DIFF: https://github.com/llvm/llvm-project/commit/a7ac0dd624962de1ccb55f1ed1357f548477f593.diff

LOG: [NFC][OpenMP] Use `SimpleVLA` to replace variable length arrays in C++

Added: 
    

Modified: 
    openmp/runtime/src/kmp_csupport.cpp

Removed: 
    


################################################################################
diff  --git a/openmp/runtime/src/kmp_csupport.cpp b/openmp/runtime/src/kmp_csupport.cpp
index 878e78b5c7ad2d..0268f692ff7fdc 100644
--- a/openmp/runtime/src/kmp_csupport.cpp
+++ b/openmp/runtime/src/kmp_csupport.cpp
@@ -18,6 +18,7 @@
 #include "kmp_itt.h"
 #include "kmp_lock.h"
 #include "kmp_stats.h"
+#include "kmp_utils.h"
 #include "ompt-specific.h"
 
 #define MAX_MESSAGE 512
@@ -4233,7 +4234,7 @@ void __kmpc_doacross_wait(ident_t *loc, int gtid, const kmp_int64 *vec) {
   up = pr_buf->th_doacross_info[3];
   st = pr_buf->th_doacross_info[4];
 #if OMPT_SUPPORT && OMPT_OPTIONAL
-  ompt_dependence_t deps[num_dims];
+  SimpleVLA<ompt_dependence_t> deps(num_dims);
 #endif
   if (st == 1) { // most common case
     if (vec[0] < lo || vec[0] > up) {
@@ -4345,7 +4346,7 @@ void __kmpc_doacross_post(ident_t *loc, int gtid, const kmp_int64 *vec) {
   lo = pr_buf->th_doacross_info[2];
   st = pr_buf->th_doacross_info[4];
 #if OMPT_SUPPORT && OMPT_OPTIONAL
-  ompt_dependence_t deps[num_dims];
+  SimpleVLA<ompt_dependence_t> deps(num_dims);
 #endif
   if (st == 1) { // most common case
     iter_number = vec[0] - lo;


        


More information about the Openmp-commits mailing list