[clang] [OpenMP] Add runtime selection for metadirective with non-constant conditions. (PR #192455)

via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 16 06:53:27 PDT 2026


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 origin/main HEAD --extensions h,cpp -- clang/test/OpenMP/metadirective_user_condition_codegen.cpp clang/include/clang/AST/StmtOpenMP.h clang/lib/CodeGen/CGStmtOpenMP.cpp clang/lib/Parse/ParseOpenMP.cpp clang/lib/Sema/SemaOpenMP.cpp clang/lib/Sema/SemaStmt.cpp --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

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

``````````diff
diff --git a/clang/include/clang/AST/StmtOpenMP.h b/clang/include/clang/AST/StmtOpenMP.h
index 435a060f4..398c484e2 100644
--- a/clang/include/clang/AST/StmtOpenMP.h
+++ b/clang/include/clang/AST/StmtOpenMP.h
@@ -6406,7 +6406,7 @@ public:
   Stmt *getIfStmt() const { return IfStmt; }
 
   void setNonConstantUserConditions(ArrayRef<Expr *> Conds,
-                                     ArrayRef<OpenMPDirectiveKind> Variants) {
+                                    ArrayRef<OpenMPDirectiveKind> Variants) {
     HasNonConstantConditions = true;
     NumConditions = Conds.size();
     Conditions = const_cast<Expr **>(Conds.data());
diff --git a/clang/lib/CodeGen/CGStmtOpenMP.cpp b/clang/lib/CodeGen/CGStmtOpenMP.cpp
index 604a1762d..036372823 100644
--- a/clang/lib/CodeGen/CGStmtOpenMP.cpp
+++ b/clang/lib/CodeGen/CGStmtOpenMP.cpp
@@ -2162,8 +2162,7 @@ void CodeGenFunction::EmitOMPParallelDirective(const OMPParallelDirective &S) {
 /// Used for runtime metadirective selection.
 static void EmitOMPDirectiveWithBody(CodeGenFunction &CGF,
                                      OpenMPDirectiveKind DKind,
-                                     const Stmt *Body,
-                                     SourceLocation Loc) {
+                                     const Stmt *Body, SourceLocation Loc) {
   auto &RT = CGF.CGM.getOpenMPRuntime();
 
   switch (DKind) {
@@ -2205,8 +2204,7 @@ static void EmitOMPDirectiveWithBody(CodeGenFunction &CGF,
     // Emit call to __kmpc_fork_call(loc, 0, outlined_fn).
     llvm::Value *RTLoc = RT.emitUpdateLocation(CGF, Loc);
     llvm::Value *ForkCallArgs[] = {
-        RTLoc,
-        CGF.Builder.getInt32(0),
+        RTLoc, CGF.Builder.getInt32(0),
         CGF.Builder.CreateBitCast(OutlinedFn,
                                   llvm::PointerType::getUnqual(Ctx))};
 

``````````

</details>


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


More information about the cfe-commits mailing list