[clang] [llvm] Reland: [OpenMP][clang] 6.0: num_threads strict (part 3: codegen) (PR #155839)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 28 07:18:03 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang-codegen
Author: Robert Imschweiler (ro-i)
<details>
<summary>Changes</summary>
OpenMP 6.0 12.1.2 specifies the behavior of the strict modifier for the
num_threads clause on parallel directives, along with the message and
severity clauses. This commit implements necessary codegen changes.
Note: this is https://github.com/llvm/llvm-project/pull/146405 + the second commit that uses the existing `INTPTR_T_TY` variable for the getelementptr index type instead of i64. This is necessary because the target triple in `clang/test/OpenMP/parallel_num_threads_codegen.cpp` is `%itanium_abi_triple` and thus expands to the target triple of the current machine. Should thus fix https://lab.llvm.org/buildbot/#/builders/154/builds/20818
---
Patch is 1.38 MiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/155839.diff
29 Files Affected:
- (modified) clang/include/clang/AST/OpenMPClause.h (+20-39)
- (modified) clang/include/clang/Basic/DiagnosticParseKinds.td (+3-1)
- (modified) clang/lib/AST/OpenMPClause.cpp (+6-3)
- (modified) clang/lib/CodeGen/CGOpenMPRuntime.cpp (+61-26)
- (modified) clang/lib/CodeGen/CGOpenMPRuntime.h (+53-10)
- (modified) clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp (+27-26)
- (modified) clang/lib/CodeGen/CGOpenMPRuntimeGPU.h (+21-5)
- (modified) clang/lib/CodeGen/CGStmtOpenMP.cpp (+14-2)
- (modified) clang/lib/Sema/SemaOpenMP.cpp (+36-12)
- (modified) clang/lib/Sema/TreeTransform.h (+1-2)
- (modified) clang/lib/Serialization/ASTReader.cpp (+1)
- (modified) clang/lib/Serialization/ASTWriter.cpp (+1)
- (added) clang/test/OpenMP/amdgcn_target_parallel_num_threads_codegen.cpp (+1095)
- (modified) clang/test/OpenMP/distribute_parallel_for_num_threads_codegen.cpp (+2708-172)
- (added) clang/test/OpenMP/distribute_parallel_for_simd_num_threads_strict_codegen.cpp (+3541)
- (modified) clang/test/OpenMP/error_codegen.cpp (+701-33)
- (modified) clang/test/OpenMP/error_message.cpp (+5-1)
- (modified) clang/test/OpenMP/nvptx_target_codegen.cpp (+847-66)
- (modified) clang/test/OpenMP/nvptx_target_parallel_num_threads_codegen.cpp (+725-35)
- (modified) clang/test/OpenMP/parallel_generic_loop_codegen.cpp (+212-2)
- (modified) clang/test/OpenMP/parallel_message_messages.cpp (+22-6)
- (modified) clang/test/OpenMP/parallel_num_threads_codegen.cpp (+46)
- (modified) clang/test/OpenMP/target_parallel_generic_loop_codegen.cpp (+418-18)
- (modified) clang/test/OpenMP/target_parallel_num_threads_messages.cpp (+103-3)
- (added) clang/test/OpenMP/target_parallel_num_threads_strict_codegen.cpp (+2956)
- (added) clang/test/OpenMP/teams_distribute_parallel_for_num_threads_strict_codegen.cpp (+1447)
- (added) clang/test/OpenMP/teams_distribute_parallel_for_simd_num_threads_strict_codegen.cpp (+1911)
- (modified) llvm/include/llvm/Frontend/OpenMP/OMP.td (+67-1)
- (modified) llvm/include/llvm/Frontend/OpenMP/OMPKinds.def (+12)
``````````diff
diff --git a/clang/include/clang/AST/OpenMPClause.h b/clang/include/clang/AST/OpenMPClause.h
index 1118d3e062e68..72effbc3e02fc 100644
--- a/clang/include/clang/AST/OpenMPClause.h
+++ b/clang/include/clang/AST/OpenMPClause.h
@@ -1865,62 +1865,43 @@ class OMPSeverityClause final : public OMPClause {
/// \endcode
/// In this example directive '#pragma omp error' has simple
/// 'message' clause with user error message of "GNU compiler required.".
-class OMPMessageClause final : public OMPClause {
+class OMPMessageClause final
+ : public OMPOneStmtClause<llvm::omp::OMPC_message, OMPClause>,
+ public OMPClauseWithPreInit {
friend class OMPClauseReader;
- /// Location of '('
- SourceLocation LParenLoc;
-
- // Expression of the 'message' clause.
- Stmt *MessageString = nullptr;
-
/// Set message string of the clause.
- void setMessageString(Expr *MS) { MessageString = MS; }
-
- /// Sets the location of '('.
- void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
+ void setMessageString(Expr *MS) { setStmt(MS); }
public:
/// Build 'message' clause with message string argument
///
/// \param MS Argument of the clause (message string).
+ /// \param HelperMS Helper statement for the construct.
+ /// \param CaptureRegion Innermost OpenMP region where expressions in this
+ /// clause must be captured.
/// \param StartLoc Starting location of the clause.
/// \param LParenLoc Location of '('.
/// \param EndLoc Ending location of the clause.
- OMPMessageClause(Expr *MS, SourceLocation StartLoc, SourceLocation LParenLoc,
+ OMPMessageClause(Expr *MS, Stmt *HelperMS, OpenMPDirectiveKind CaptureRegion,
+ SourceLocation StartLoc, SourceLocation LParenLoc,
SourceLocation EndLoc)
- : OMPClause(llvm::omp::OMPC_message, StartLoc, EndLoc),
- LParenLoc(LParenLoc), MessageString(MS) {}
-
- /// Build an empty clause.
- OMPMessageClause()
- : OMPClause(llvm::omp::OMPC_message, SourceLocation(), SourceLocation()) {
+ : OMPOneStmtClause(MS, StartLoc, LParenLoc, EndLoc),
+ OMPClauseWithPreInit(this) {
+ setPreInitStmt(HelperMS, CaptureRegion);
}
- /// Returns the locaiton of '('.
- SourceLocation getLParenLoc() const { return LParenLoc; }
+ /// Build an empty clause.
+ OMPMessageClause() : OMPOneStmtClause(), OMPClauseWithPreInit(this) {}
/// Returns message string of the clause.
- Expr *getMessageString() const { return cast_or_null<Expr>(MessageString); }
-
- child_range children() {
- return child_range(&MessageString, &MessageString + 1);
- }
-
- const_child_range children() const {
- return const_child_range(&MessageString, &MessageString + 1);
- }
-
- child_range used_children() {
- return child_range(child_iterator(), child_iterator());
- }
-
- const_child_range used_children() const {
- return const_child_range(const_child_iterator(), const_child_iterator());
- }
+ Expr *getMessageString() const { return getStmtAs<Expr>(); }
- static bool classof(const OMPClause *T) {
- return T->getClauseKind() == llvm::omp::OMPC_message;
+ /// Try to evaluate the message string at compile time.
+ std::optional<std::string> tryEvaluateString(ASTContext &Ctx) const {
+ if (Expr *MessageExpr = getMessageString())
+ return MessageExpr->tryEvaluateString(Ctx);
+ return std::nullopt;
}
};
diff --git a/clang/include/clang/Basic/DiagnosticParseKinds.td b/clang/include/clang/Basic/DiagnosticParseKinds.td
index 3a6a9e582c7ca..d1a60490b6517 100644
--- a/clang/include/clang/Basic/DiagnosticParseKinds.td
+++ b/clang/include/clang/Basic/DiagnosticParseKinds.td
@@ -1506,8 +1506,10 @@ def err_omp_unexpected_directive : Error<
"unexpected OpenMP directive %select{|'#pragma omp %1'}0">;
def err_omp_expected_punc : Error<
"expected ',' or ')' in '%0' %select{clause|directive}1">;
-def warn_clause_expected_string : Warning<
+def warn_clause_expected_string_literal : Warning<
"expected string literal in 'clause %0' - ignoring">, InGroup<IgnoredPragmas>;
+def warn_clause_expected_string: Warning<
+ "expected string in 'clause %0' - ignoring">, InGroup<IgnoredPragmas>;
def err_omp_unexpected_clause : Error<
"unexpected OpenMP clause '%0' in directive '#pragma omp %1'">;
def err_omp_unexpected_clause_extension_only : Error<
diff --git a/clang/lib/AST/OpenMPClause.cpp b/clang/lib/AST/OpenMPClause.cpp
index 588b0dcc6d7b8..0930ca27c29f8 100644
--- a/clang/lib/AST/OpenMPClause.cpp
+++ b/clang/lib/AST/OpenMPClause.cpp
@@ -104,6 +104,8 @@ const OMPClauseWithPreInit *OMPClauseWithPreInit::get(const OMPClause *C) {
return static_cast<const OMPFilterClause *>(C);
case OMPC_ompx_dyn_cgroup_mem:
return static_cast<const OMPXDynCGroupMemClause *>(C);
+ case OMPC_message:
+ return static_cast<const OMPMessageClause *>(C);
case OMPC_default:
case OMPC_proc_bind:
case OMPC_safelen:
@@ -158,7 +160,6 @@ const OMPClauseWithPreInit *OMPClauseWithPreInit::get(const OMPClause *C) {
case OMPC_self_maps:
case OMPC_at:
case OMPC_severity:
- case OMPC_message:
case OMPC_device_type:
case OMPC_match:
case OMPC_nontemporal:
@@ -1963,8 +1964,10 @@ void OMPClausePrinter::VisitOMPSeverityClause(OMPSeverityClause *Node) {
}
void OMPClausePrinter::VisitOMPMessageClause(OMPMessageClause *Node) {
- OS << "message(\""
- << cast<StringLiteral>(Node->getMessageString())->getString() << "\")";
+ OS << "message(";
+ if (Expr *E = Node->getMessageString())
+ E->printPretty(OS, nullptr, Policy);
+ OS << ")";
}
void OMPClausePrinter::VisitOMPScheduleClause(OMPScheduleClause *Node) {
diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.cpp b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
index b66608319bb51..b38eb54036e60 100644
--- a/clang/lib/CodeGen/CGOpenMPRuntime.cpp
+++ b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
@@ -1845,11 +1845,11 @@ void CGOpenMPRuntime::emitIfClause(CodeGenFunction &CGF, const Expr *Cond,
CGF.EmitBlock(ContBlock, /*IsFinished=*/true);
}
-void CGOpenMPRuntime::emitParallelCall(CodeGenFunction &CGF, SourceLocation Loc,
- llvm::Function *OutlinedFn,
- ArrayRef<llvm::Value *> CapturedVars,
- const Expr *IfCond,
- llvm::Value *NumThreads) {
+void CGOpenMPRuntime::emitParallelCall(
+ CodeGenFunction &CGF, SourceLocation Loc, llvm::Function *OutlinedFn,
+ ArrayRef<llvm::Value *> CapturedVars, const Expr *IfCond,
+ llvm::Value *NumThreads, OpenMPNumThreadsClauseModifier NumThreadsModifier,
+ OpenMPSeverityClauseKind Severity, const Expr *Message) {
if (!CGF.HaveInsertPoint())
return;
llvm::Value *RTLoc = emitUpdateLocation(CGF, Loc);
@@ -2372,9 +2372,8 @@ void CGOpenMPRuntime::emitBarrierCall(CodeGenFunction &CGF, SourceLocation Loc,
void CGOpenMPRuntime::emitErrorCall(CodeGenFunction &CGF, SourceLocation Loc,
Expr *ME, bool IsFatal) {
- llvm::Value *MVL =
- ME ? CGF.EmitStringLiteralLValue(cast<StringLiteral>(ME)).getPointer(CGF)
- : llvm::ConstantPointerNull::get(CGF.VoidPtrTy);
+ llvm::Value *MVL = ME ? CGF.EmitScalarExpr(ME)
+ : llvm::ConstantPointerNull::get(CGF.VoidPtrTy);
// Build call void __kmpc_error(ident_t *loc, int severity, const char
// *message)
llvm::Value *Args[] = {
@@ -2699,18 +2698,54 @@ llvm::Value *CGOpenMPRuntime::emitForNext(CodeGenFunction &CGF,
CGF.getContext().BoolTy, Loc);
}
-void CGOpenMPRuntime::emitNumThreadsClause(CodeGenFunction &CGF,
- llvm::Value *NumThreads,
- SourceLocation Loc) {
+llvm::Value *CGOpenMPRuntime::emitMessageClause(CodeGenFunction &CGF,
+ const Expr *Message) {
+ if (!Message)
+ return llvm::ConstantPointerNull::get(CGF.VoidPtrTy);
+ return CGF.EmitScalarExpr(Message);
+}
+
+llvm::Value *
+CGOpenMPRuntime::emitMessageClause(CodeGenFunction &CGF,
+ const OMPMessageClause *MessageClause) {
+ return emitMessageClause(
+ CGF, MessageClause ? MessageClause->getMessageString() : nullptr);
+}
+
+llvm::Value *
+CGOpenMPRuntime::emitSeverityClause(OpenMPSeverityClauseKind Severity) {
+ // OpenMP 6.0, 10.4: "If no severity clause is specified then the effect is
+ // as if sev-level is fatal."
+ return llvm::ConstantInt::get(CGM.Int32Ty,
+ Severity == OMPC_SEVERITY_warning ? 1 : 2);
+}
+
+llvm::Value *
+CGOpenMPRuntime::emitSeverityClause(const OMPSeverityClause *SeverityClause) {
+ return emitSeverityClause(SeverityClause ? SeverityClause->getSeverityKind()
+ : OMPC_SEVERITY_unknown);
+}
+
+void CGOpenMPRuntime::emitNumThreadsClause(
+ CodeGenFunction &CGF, llvm::Value *NumThreads, SourceLocation Loc,
+ OpenMPNumThreadsClauseModifier Modifier, OpenMPSeverityClauseKind Severity,
+ const Expr *Message) {
if (!CGF.HaveInsertPoint())
return;
+ llvm::SmallVector<llvm::Value *, 4> Args(
+ {emitUpdateLocation(CGF, Loc), getThreadID(CGF, Loc),
+ CGF.Builder.CreateIntCast(NumThreads, CGF.Int32Ty, /*isSigned*/ true)});
// Build call __kmpc_push_num_threads(&loc, global_tid, num_threads)
- llvm::Value *Args[] = {
- emitUpdateLocation(CGF, Loc), getThreadID(CGF, Loc),
- CGF.Builder.CreateIntCast(NumThreads, CGF.Int32Ty, /*isSigned*/ true)};
- CGF.EmitRuntimeCall(OMPBuilder.getOrCreateRuntimeFunction(
- CGM.getModule(), OMPRTL___kmpc_push_num_threads),
- Args);
+ // or __kmpc_push_num_threads_strict(&loc, global_tid, num_threads, severity,
+ // messsage) if strict modifier is used.
+ RuntimeFunction FnID = OMPRTL___kmpc_push_num_threads;
+ if (Modifier == OMPC_NUMTHREADS_strict) {
+ FnID = OMPRTL___kmpc_push_num_threads_strict;
+ Args.push_back(emitSeverityClause(Severity));
+ Args.push_back(emitMessageClause(CGF, Message));
+ }
+ CGF.EmitRuntimeCall(
+ OMPBuilder.getOrCreateRuntimeFunction(CGM.getModule(), FnID), Args);
}
void CGOpenMPRuntime::emitProcBindClause(CodeGenFunction &CGF,
@@ -12114,12 +12149,11 @@ llvm::Function *CGOpenMPSIMDRuntime::emitTaskOutlinedFunction(
llvm_unreachable("Not supported in SIMD-only mode");
}
-void CGOpenMPSIMDRuntime::emitParallelCall(CodeGenFunction &CGF,
- SourceLocation Loc,
- llvm::Function *OutlinedFn,
- ArrayRef<llvm::Value *> CapturedVars,
- const Expr *IfCond,
- llvm::Value *NumThreads) {
+void CGOpenMPSIMDRuntime::emitParallelCall(
+ CodeGenFunction &CGF, SourceLocation Loc, llvm::Function *OutlinedFn,
+ ArrayRef<llvm::Value *> CapturedVars, const Expr *IfCond,
+ llvm::Value *NumThreads, OpenMPNumThreadsClauseModifier NumThreadsModifier,
+ OpenMPSeverityClauseKind Severity, const Expr *Message) {
llvm_unreachable("Not supported in SIMD-only mode");
}
@@ -12222,9 +12256,10 @@ llvm::Value *CGOpenMPSIMDRuntime::emitForNext(CodeGenFunction &CGF,
llvm_unreachable("Not supported in SIMD-only mode");
}
-void CGOpenMPSIMDRuntime::emitNumThreadsClause(CodeGenFunction &CGF,
- llvm::Value *NumThreads,
- SourceLocation Loc) {
+void CGOpenMPSIMDRuntime::emitNumThreadsClause(
+ CodeGenFunction &CGF, llvm::Value *NumThreads, SourceLocation Loc,
+ OpenMPNumThreadsClauseModifier Modifier, OpenMPSeverityClauseKind Severity,
+ const Expr *Message) {
llvm_unreachable("Not supported in SIMD-only mode");
}
diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.h b/clang/lib/CodeGen/CGOpenMPRuntime.h
index 5be48b439f4fd..eb04eceee236c 100644
--- a/clang/lib/CodeGen/CGOpenMPRuntime.h
+++ b/clang/lib/CodeGen/CGOpenMPRuntime.h
@@ -777,11 +777,22 @@ class CGOpenMPRuntime {
/// specified, nullptr otherwise.
/// \param NumThreads The value corresponding to the num_threads clause, if
/// any, or nullptr.
+ /// \param NumThreadsModifier The modifier of the num_threads clause, if
+ /// any, ignored otherwise.
+ /// \param Severity The severity corresponding to the num_threads clause, if
+ /// any, ignored otherwise.
+ /// \param Message The message string corresponding to the num_threads clause,
+ /// if any, or nullptr.
///
- virtual void emitParallelCall(CodeGenFunction &CGF, SourceLocation Loc,
- llvm::Function *OutlinedFn,
- ArrayRef<llvm::Value *> CapturedVars,
- const Expr *IfCond, llvm::Value *NumThreads);
+ virtual void
+ emitParallelCall(CodeGenFunction &CGF, SourceLocation Loc,
+ llvm::Function *OutlinedFn,
+ ArrayRef<llvm::Value *> CapturedVars, const Expr *IfCond,
+ llvm::Value *NumThreads,
+ OpenMPNumThreadsClauseModifier NumThreadsModifier =
+ OMPC_NUMTHREADS_unknown,
+ OpenMPSeverityClauseKind Severity = OMPC_SEVERITY_fatal,
+ const Expr *Message = nullptr);
/// Emits a critical region.
/// \param CriticalName Name of the critical region.
@@ -1037,13 +1048,28 @@ class CGOpenMPRuntime {
Address IL, Address LB,
Address UB, Address ST);
+ virtual llvm::Value *emitMessageClause(CodeGenFunction &CGF,
+ const Expr *Message);
+ virtual llvm::Value *emitMessageClause(CodeGenFunction &CGF,
+ const OMPMessageClause *MessageClause);
+
+ virtual llvm::Value *emitSeverityClause(OpenMPSeverityClauseKind Severity);
+ virtual llvm::Value *
+ emitSeverityClause(const OMPSeverityClause *SeverityClause);
+
/// Emits call to void __kmpc_push_num_threads(ident_t *loc, kmp_int32
/// global_tid, kmp_int32 num_threads) to generate code for 'num_threads'
/// clause.
+ /// If the modifier 'strict' is given:
+ /// Emits call to void __kmpc_push_num_threads_strict(ident_t *loc, kmp_int32
+ /// global_tid, kmp_int32 num_threads, int severity, const char *message) to
+ /// generate code for 'num_threads' clause with 'strict' modifier.
/// \param NumThreads An integer value of threads.
- virtual void emitNumThreadsClause(CodeGenFunction &CGF,
- llvm::Value *NumThreads,
- SourceLocation Loc);
+ virtual void emitNumThreadsClause(
+ CodeGenFunction &CGF, llvm::Value *NumThreads, SourceLocation Loc,
+ OpenMPNumThreadsClauseModifier Modifier = OMPC_NUMTHREADS_unknown,
+ OpenMPSeverityClauseKind Severity = OMPC_SEVERITY_fatal,
+ const Expr *Message = nullptr);
/// Emit call to void __kmpc_push_proc_bind(ident_t *loc, kmp_int32
/// global_tid, int proc_bind) to generate code for 'proc_bind' clause.
@@ -1737,11 +1763,21 @@ class CGOpenMPSIMDRuntime final : public CGOpenMPRuntime {
/// specified, nullptr otherwise.
/// \param NumThreads The value corresponding to the num_threads clause, if
/// any, or nullptr.
+ /// \param NumThreadsModifier The modifier of the num_threads clause, if
+ /// any, ignored otherwise.
+ /// \param Severity The severity corresponding to the num_threads clause, if
+ /// any, ignored otherwise.
+ /// \param Message The message string corresponding to the num_threads clause,
+ /// if any, or nullptr.
///
void emitParallelCall(CodeGenFunction &CGF, SourceLocation Loc,
llvm::Function *OutlinedFn,
ArrayRef<llvm::Value *> CapturedVars,
- const Expr *IfCond, llvm::Value *NumThreads) override;
+ const Expr *IfCond, llvm::Value *NumThreads,
+ OpenMPNumThreadsClauseModifier NumThreadsModifier =
+ OMPC_NUMTHREADS_unknown,
+ OpenMPSeverityClauseKind Severity = OMPC_SEVERITY_fatal,
+ const Expr *Message = nullptr) override;
/// Emits a critical region.
/// \param CriticalName Name of the critical region.
@@ -1911,9 +1947,16 @@ class CGOpenMPSIMDRuntime final : public CGOpenMPRuntime {
/// Emits call to void __kmpc_push_num_threads(ident_t *loc, kmp_int32
/// global_tid, kmp_int32 num_threads) to generate code for 'num_threads'
/// clause.
+ /// If the modifier 'strict' is given:
+ /// Emits call to void __kmpc_push_num_threads_strict(ident_t *loc, kmp_int32
+ /// global_tid, kmp_int32 num_threads, int severity, const char *message) to
+ /// generate code for 'num_threads' clause with 'strict' modifier.
/// \param NumThreads An integer value of threads.
- void emitNumThreadsClause(CodeGenFunction &CGF, llvm::Value *NumThreads,
- SourceLocation Loc) override;
+ void emitNumThreadsClause(
+ CodeGenFunction &CGF, llvm::Value *NumThreads, SourceLocation Loc,
+ OpenMPNumThreadsClauseModifier Modifier = OMPC_NUMTHREADS_unknown,
+ OpenMPSeverityClauseKind Severity = OMPC_SEVERITY_fatal,
+ const Expr *Message = nullptr) override;
/// Emit call to void __kmpc_push_proc_bind(ident_t *loc, kmp_int32
/// global_tid, int proc_bind) to generate code for 'proc_bind' clause.
diff --git a/clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp b/clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
index cff1071dd1c2e..a80d9fd68ef2f 100644
--- a/clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
+++ b/clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
@@ -899,9 +899,10 @@ void CGOpenMPRuntimeGPU::emitProcBindClause(CodeGenFunction &CGF,
// Nothing to do.
}
-void CGOpenMPRuntimeGPU::emitNumThreadsClause(CodeGenFunction &CGF,
- llvm::Value *NumThreads,
- SourceLocation Loc) {
+void CGOpenMPRuntimeGPU::emitNumThreadsClause(
+ CodeGenFunction &CGF, llvm::Value *NumThreads, SourceLocation Loc,
+ OpenMPNumThreadsClauseModifier Modifier, OpenMPSeverityClauseKind Severity,
+ const Expr *Message) {
// Nothing to do.
}
@@ -1201,18 +1202,17 @@ void CGOpenMPRuntimeGPU::emitTeamsCall(CodeGenFunction &CGF,
emitOutlinedFunctionCall(CGF, Loc, OutlinedFn, OutlinedFnArgs);
}
-void CGOpenMPRuntimeGPU::emitParallelCall(CodeGenFunction &CGF,
- SourceLocation Loc,
- llvm::Function *OutlinedFn,
- ArrayRef<llvm::Value *> CapturedVars,
- const Expr *IfCond,
- llvm::Value *NumThreads) {
+void CGOpenMPRuntimeGPU::emitParallelCall(
+ CodeGenFunction &CGF, SourceLocation Loc, llvm::Function *OutlinedFn,
+ ArrayRef<llvm::Value *> CapturedVars, const Expr *IfCond,
+ llvm::Value *NumThreads, OpenMPNumThreadsClauseModifier NumThreadsModifier,
+ OpenMPSeverityClauseKind Severity, const Expr *Message) {
if (!CGF.HaveInsertPoint())
return;
- auto &&ParallelGen = [this, Loc, OutlinedFn, CapturedVars, IfCond,
- NumThreads](CodeGenFunction &CGF,
- PrePostActionTy &Action) {
+ auto &&ParallelGen = [this, Loc, OutlinedFn, CapturedVars, IfCond, NumThreads,
+ NumThreadsModifier, Severity, Message](
+ CodeGenFunction &CGF, PrePostActionTy &Action) {
CGBuilderTy &Bld = CGF.Builder;
llvm::Value *NumThreadsVal = NumThreads;
llvm::Function *WFn = WrapperFunctionsMap[OutlinedFn];
@@ -1260,21 +1260,22 @@ void CGOpenMPRuntimeGPU::emitParallelCall(CodeGenFunction &CGF,
NumThreadsVal = Bld.CreateZExtOrTrunc(NumThreadsVal, CGF.Int32Ty);
assert(IfCondVal && "Expected a value");
+ RuntimeFunction FnID = OMPRTL___kmpc_parallel_51;
llvm::Value *RTLoc = emitUpdateLocation(CGF, Loc);
- llvm::Value *Args[] = {
- RTLoc,
- getThreadID(CGF, Loc),
- IfCondVal,
- NumThreadsVal,
- llvm::ConstantInt::get(CGF.Int32Ty, -1),
- F...
[truncated]
``````````
</details>
https://github.com/llvm/llvm-project/pull/155839
More information about the llvm-commits
mailing list