[clang] [OpenMP][SIMD][FIX] Use conservative "omp simd ordered" lowering (PR #123867)

via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 21 17:53:50 PST 2025


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff 07d496538f5543a8eed5e207148e28e358b7cca4 1b603f7182fa7ed14bf0aeeb7a40280c990d25bf --extensions cpp,c -- clang/test/OpenMP/simd_conservative_ordered.c clang/lib/CodeGen/CGStmtOpenMP.cpp clang/test/OpenMP/ordered_codegen.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/clang/lib/CodeGen/CGStmtOpenMP.cpp b/clang/lib/CodeGen/CGStmtOpenMP.cpp
index db2531b69c..3542e93967 100644
--- a/clang/lib/CodeGen/CGStmtOpenMP.cpp
+++ b/clang/lib/CodeGen/CGStmtOpenMP.cpp
@@ -2462,7 +2462,8 @@ static void emitSimdlenSafelenClause(CodeGenFunction &CGF,
 //
 // Consider the following source code:
 // ```
-// __attribute__((noinline)) void omp_simd_loop(float X[ARRAY_SIZE][ARRAY_SIZE]) {
+// __attribute__((noinline)) void omp_simd_loop(float X[ARRAY_SIZE][ARRAY_SIZE])
+// {
 //     for (int r = 1; r < ARRAY_SIZE; ++r) {
 //         for (int c = 1; c < ARRAY_SIZE; ++c) {
 // #pragma omp simd
@@ -2475,8 +2476,9 @@ static void emitSimdlenSafelenClause(CodeGenFunction &CGF,
 // }
 // ```
 //
-// Suppose we are in `CodeGenFunction::EmitOMPSimdInit(const OMPLoopDirective &D)`.
-// By examining `D.dump()` we have the following AST containing `OMPOrderedDirective`:
+// Suppose we are in `CodeGenFunction::EmitOMPSimdInit(const OMPLoopDirective
+// &D)`. By examining `D.dump()` we have the following AST containing
+// `OMPOrderedDirective`:
 //
 // ```
 // OMPSimdDirective 0x1c32950
@@ -2500,8 +2502,9 @@ static void emitSimdlenSafelenClause(CodeGenFunction &CGF,
 // ```
 //
 // Note the presence of `OMPOrderedDirective` above:
-// It's (transitively) nested in a `CapturedStmt` representing the pragma annotated compound statement.
-// Thus, we need to consider this nesting and include checking the `getCapturedStmt` in this case.
+// It's (transitively) nested in a `CapturedStmt` representing the pragma
+// annotated compound statement. Thus, we need to consider this nesting and
+// include checking the `getCapturedStmt` in this case.
 static bool hasOrderedDirective(const Stmt *S) {
   if (isa<OMPOrderedDirective>(S))
     return true;
@@ -2517,7 +2520,8 @@ static bool hasOrderedDirective(const Stmt *S) {
   return false;
 }
 
-static void applyConservativeSimdOrderedDirective(const Stmt &AssociatedStmt, LoopInfoStack &LoopStack) {
+static void applyConservativeSimdOrderedDirective(const Stmt &AssociatedStmt,
+                                                  LoopInfoStack &LoopStack) {
   // Check for the presence of an `OMPOrderedDirective`
   // i.e., `ordered` in `#pragma omp ordered simd`
   bool HasOrderedDirective = hasOrderedDirective(&AssociatedStmt);

``````````

</details>


https://github.com/llvm/llvm-project/pull/123867


More information about the cfe-commits mailing list