[Openmp-commits] [clang] [llvm] [openmp] Revert "[OpenMP][clang] 6.0: num_threads strict (part 3: codegen)" (PR #155809)
via Openmp-commits
openmp-commits at lists.llvm.org
Thu Aug 28 03:12:56 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-flang-openmp
Author: Robert Imschweiler (ro-i)
<details>
<summary>Changes</summary>
Reverts llvm/llvm-project#<!-- -->146405
Reverting for further investigation due to getelementptr index size mismatch on ARM buildbot:
```
/home/tcwg-buildbot/worker/clang-armv8-quick/llvm/clang/test/OpenMP/parallel_num_threads_codegen.cpp:86:11: error: OMP60: expected string not found in input
// OMP60: [[ARRDECAY:%.+]] = getelementptr inbounds [4 x i8], ptr [[STR:%.+]], i64 0, i64 0
^
<stdin>:55:51: note: scanning from here
call void (ptr, i32, ptr, ...) @<!-- -->__kmpc_fork_call(ptr @<!-- -->1, i32 0, ptr @<!-- -->main.omp_outlined.1)
^
<stdin>:58:8: note: possible intended match here
%arraydecay = getelementptr inbounds [4 x i8], ptr %str, i32 0, i32 0
^
Input file: <stdin>
Check file: /home/tcwg-buildbot/worker/clang-armv8-quick/llvm/clang/test/OpenMP/parallel_num_threads_codegen.cpp
-dump-input=help explains the following input dump.
Input was:
<<<<<<
.
.
.
50: call void @<!-- -->__kmpc_push_num_threads(ptr @<!-- -->1, i32 %0, i32 2)
51: call void (ptr, i32, ptr, ...) @<!-- -->__kmpc_fork_call(ptr @<!-- -->1, i32 0, ptr @<!-- -->main.omp_outlined)
52: %1 = load i8, ptr %a, align 1
53: %2 = sext i8 %1 to i32
54: call void @<!-- -->__kmpc_push_num_threads(ptr @<!-- -->1, i32 %0, i32 %2)
55: call void (ptr, i32, ptr, ...) @<!-- -->__kmpc_fork_call(ptr @<!-- -->1, i32 0, ptr @<!-- -->main.omp_outlined.1)
check:86'0 X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
56: call void @<!-- -->llvm.memcpy.p0.p0.i32(ptr align 1 %str, ptr align 1 @<!-- -->__const.main.str, i32 4, i1 false)
check:86'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
57: store ptr @.str, ptr %str1, align 4
check:86'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
58: %arraydecay = getelementptr inbounds [4 x i8], ptr %str, i32 0, i32 0
check:86'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
check:86'1 ? possible intended match
...
```
---
Patch is 1.38 MiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/155809.diff
30 Files Affected:
- (modified) clang/include/clang/AST/OpenMPClause.h (+39-20)
- (modified) clang/include/clang/Basic/DiagnosticParseKinds.td (+1-3)
- (modified) clang/lib/AST/OpenMPClause.cpp (+3-6)
- (modified) clang/lib/CodeGen/CGOpenMPRuntime.cpp (+26-61)
- (modified) clang/lib/CodeGen/CGOpenMPRuntime.h (+10-53)
- (modified) clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp (+26-27)
- (modified) clang/lib/CodeGen/CGOpenMPRuntimeGPU.h (+5-21)
- (modified) clang/lib/CodeGen/CGStmtOpenMP.cpp (+2-14)
- (modified) clang/lib/Sema/SemaOpenMP.cpp (+12-36)
- (modified) clang/lib/Sema/TreeTransform.h (+2-1)
- (modified) clang/lib/Serialization/ASTReader.cpp (-1)
- (modified) clang/lib/Serialization/ASTWriter.cpp (-1)
- (removed) clang/test/OpenMP/amdgcn_target_parallel_num_threads_codegen.cpp (-1095)
- (modified) clang/test/OpenMP/distribute_parallel_for_num_threads_codegen.cpp (+172-2708)
- (removed) clang/test/OpenMP/distribute_parallel_for_simd_num_threads_strict_codegen.cpp (-3541)
- (modified) clang/test/OpenMP/error_codegen.cpp (+33-701)
- (modified) clang/test/OpenMP/error_message.cpp (+1-5)
- (modified) clang/test/OpenMP/nvptx_target_codegen.cpp (+66-847)
- (modified) clang/test/OpenMP/nvptx_target_parallel_num_threads_codegen.cpp (+35-725)
- (modified) clang/test/OpenMP/parallel_generic_loop_codegen.cpp (+2-212)
- (modified) clang/test/OpenMP/parallel_message_messages.cpp (+6-22)
- (modified) clang/test/OpenMP/parallel_num_threads_codegen.cpp (-46)
- (modified) clang/test/OpenMP/target_parallel_generic_loop_codegen.cpp (+18-418)
- (modified) clang/test/OpenMP/target_parallel_num_threads_messages.cpp (+3-103)
- (removed) clang/test/OpenMP/target_parallel_num_threads_strict_codegen.cpp (-2956)
- (removed) clang/test/OpenMP/teams_distribute_parallel_for_num_threads_strict_codegen.cpp (-1447)
- (removed) clang/test/OpenMP/teams_distribute_parallel_for_simd_num_threads_strict_codegen.cpp (-1911)
- (modified) llvm/include/llvm/Frontend/OpenMP/OMP.td (+1-67)
- (modified) llvm/include/llvm/Frontend/OpenMP/OMPKinds.def (-12)
- (modified) openmp/runtime/src/kmp.h (-1)
``````````diff
diff --git a/clang/include/clang/AST/OpenMPClause.h b/clang/include/clang/AST/OpenMPClause.h
index 72effbc3e02fc..1118d3e062e68 100644
--- a/clang/include/clang/AST/OpenMPClause.h
+++ b/clang/include/clang/AST/OpenMPClause.h
@@ -1865,43 +1865,62 @@ 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 OMPOneStmtClause<llvm::omp::OMPC_message, OMPClause>,
- public OMPClauseWithPreInit {
+class OMPMessageClause final : public OMPClause {
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) { setStmt(MS); }
+ void setMessageString(Expr *MS) { MessageString = MS; }
+
+ /// Sets the location of '('.
+ void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; }
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, Stmt *HelperMS, OpenMPDirectiveKind CaptureRegion,
- SourceLocation StartLoc, SourceLocation LParenLoc,
+ OMPMessageClause(Expr *MS, SourceLocation StartLoc, SourceLocation LParenLoc,
SourceLocation EndLoc)
- : OMPOneStmtClause(MS, StartLoc, LParenLoc, EndLoc),
- OMPClauseWithPreInit(this) {
- setPreInitStmt(HelperMS, CaptureRegion);
- }
+ : OMPClause(llvm::omp::OMPC_message, StartLoc, EndLoc),
+ LParenLoc(LParenLoc), MessageString(MS) {}
/// Build an empty clause.
- OMPMessageClause() : OMPOneStmtClause(), OMPClauseWithPreInit(this) {}
+ OMPMessageClause()
+ : OMPClause(llvm::omp::OMPC_message, SourceLocation(), SourceLocation()) {
+ }
+
+ /// Returns the locaiton of '('.
+ SourceLocation getLParenLoc() const { return LParenLoc; }
/// Returns message string of the clause.
- Expr *getMessageString() const { return getStmtAs<Expr>(); }
+ 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());
+ }
- /// 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;
+ static bool classof(const OMPClause *T) {
+ return T->getClauseKind() == llvm::omp::OMPC_message;
}
};
diff --git a/clang/include/clang/Basic/DiagnosticParseKinds.td b/clang/include/clang/Basic/DiagnosticParseKinds.td
index d1a60490b6517..3a6a9e582c7ca 100644
--- a/clang/include/clang/Basic/DiagnosticParseKinds.td
+++ b/clang/include/clang/Basic/DiagnosticParseKinds.td
@@ -1506,10 +1506,8 @@ 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_literal : Warning<
+def warn_clause_expected_string : 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 0930ca27c29f8..588b0dcc6d7b8 100644
--- a/clang/lib/AST/OpenMPClause.cpp
+++ b/clang/lib/AST/OpenMPClause.cpp
@@ -104,8 +104,6 @@ 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:
@@ -160,6 +158,7 @@ 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:
@@ -1964,10 +1963,8 @@ void OMPClausePrinter::VisitOMPSeverityClause(OMPSeverityClause *Node) {
}
void OMPClausePrinter::VisitOMPMessageClause(OMPMessageClause *Node) {
- OS << "message(";
- if (Expr *E = Node->getMessageString())
- E->printPretty(OS, nullptr, Policy);
- OS << ")";
+ OS << "message(\""
+ << cast<StringLiteral>(Node->getMessageString())->getString() << "\")";
}
void OMPClausePrinter::VisitOMPScheduleClause(OMPScheduleClause *Node) {
diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.cpp b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
index b38eb54036e60..b66608319bb51 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, OpenMPNumThreadsClauseModifier NumThreadsModifier,
- OpenMPSeverityClauseKind Severity, const Expr *Message) {
+void CGOpenMPRuntime::emitParallelCall(CodeGenFunction &CGF, SourceLocation Loc,
+ llvm::Function *OutlinedFn,
+ ArrayRef<llvm::Value *> CapturedVars,
+ const Expr *IfCond,
+ llvm::Value *NumThreads) {
if (!CGF.HaveInsertPoint())
return;
llvm::Value *RTLoc = emitUpdateLocation(CGF, Loc);
@@ -2372,8 +2372,9 @@ void CGOpenMPRuntime::emitBarrierCall(CodeGenFunction &CGF, SourceLocation Loc,
void CGOpenMPRuntime::emitErrorCall(CodeGenFunction &CGF, SourceLocation Loc,
Expr *ME, bool IsFatal) {
- llvm::Value *MVL = ME ? CGF.EmitScalarExpr(ME)
- : llvm::ConstantPointerNull::get(CGF.VoidPtrTy);
+ llvm::Value *MVL =
+ ME ? CGF.EmitStringLiteralLValue(cast<StringLiteral>(ME)).getPointer(CGF)
+ : llvm::ConstantPointerNull::get(CGF.VoidPtrTy);
// Build call void __kmpc_error(ident_t *loc, int severity, const char
// *message)
llvm::Value *Args[] = {
@@ -2698,54 +2699,18 @@ llvm::Value *CGOpenMPRuntime::emitForNext(CodeGenFunction &CGF,
CGF.getContext().BoolTy, 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) {
+void CGOpenMPRuntime::emitNumThreadsClause(CodeGenFunction &CGF,
+ llvm::Value *NumThreads,
+ SourceLocation Loc) {
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)
- // 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);
+ 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);
}
void CGOpenMPRuntime::emitProcBindClause(CodeGenFunction &CGF,
@@ -12149,11 +12114,12 @@ 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, OpenMPNumThreadsClauseModifier NumThreadsModifier,
- OpenMPSeverityClauseKind Severity, const Expr *Message) {
+void CGOpenMPSIMDRuntime::emitParallelCall(CodeGenFunction &CGF,
+ SourceLocation Loc,
+ llvm::Function *OutlinedFn,
+ ArrayRef<llvm::Value *> CapturedVars,
+ const Expr *IfCond,
+ llvm::Value *NumThreads) {
llvm_unreachable("Not supported in SIMD-only mode");
}
@@ -12256,10 +12222,9 @@ llvm::Value *CGOpenMPSIMDRuntime::emitForNext(CodeGenFunction &CGF,
llvm_unreachable("Not supported in SIMD-only mode");
}
-void CGOpenMPSIMDRuntime::emitNumThreadsClause(
- CodeGenFunction &CGF, llvm::Value *NumThreads, SourceLocation Loc,
- OpenMPNumThreadsClauseModifier Modifier, OpenMPSeverityClauseKind Severity,
- const Expr *Message) {
+void CGOpenMPSIMDRuntime::emitNumThreadsClause(CodeGenFunction &CGF,
+ llvm::Value *NumThreads,
+ SourceLocation Loc) {
llvm_unreachable("Not supported in SIMD-only mode");
}
diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.h b/clang/lib/CodeGen/CGOpenMPRuntime.h
index eb04eceee236c..5be48b439f4fd 100644
--- a/clang/lib/CodeGen/CGOpenMPRuntime.h
+++ b/clang/lib/CodeGen/CGOpenMPRuntime.h
@@ -777,22 +777,11 @@ 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,
- OpenMPNumThreadsClauseModifier NumThreadsModifier =
- OMPC_NUMTHREADS_unknown,
- OpenMPSeverityClauseKind Severity = OMPC_SEVERITY_fatal,
- const Expr *Message = nullptr);
+ virtual void emitParallelCall(CodeGenFunction &CGF, SourceLocation Loc,
+ llvm::Function *OutlinedFn,
+ ArrayRef<llvm::Value *> CapturedVars,
+ const Expr *IfCond, llvm::Value *NumThreads);
/// Emits a critical region.
/// \param CriticalName Name of the critical region.
@@ -1048,28 +1037,13 @@ 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,
- OpenMPNumThreadsClauseModifier Modifier = OMPC_NUMTHREADS_unknown,
- OpenMPSeverityClauseKind Severity = OMPC_SEVERITY_fatal,
- const Expr *Message = nullptr);
+ virtual void emitNumThreadsClause(CodeGenFunction &CGF,
+ llvm::Value *NumThreads,
+ SourceLocation Loc);
/// 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.
@@ -1763,21 +1737,11 @@ 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,
- OpenMPNumThreadsClauseModifier NumThreadsModifier =
- OMPC_NUMTHREADS_unknown,
- OpenMPSeverityClauseKind Severity = OMPC_SEVERITY_fatal,
- const Expr *Message = nullptr) override;
+ const Expr *IfCond, llvm::Value *NumThreads) override;
/// Emits a critical region.
/// \param CriticalName Name of the critical region.
@@ -1947,16 +1911,9 @@ 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,
- OpenMPNumThreadsClauseModifier Modifier = OMPC_NUMTHREADS_unknown,
- OpenMPSeverityClauseKind Severity = OMPC_SEVERITY_fatal,
- const Expr *Message = nullptr) override;
+ void emitNumThreadsClause(CodeGenFunction &CGF, llvm::Value *NumThreads,
+ SourceLocation Loc) 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 a80d9fd68ef2f..cff1071dd1c2e 100644
--- a/clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
+++ b/clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
@@ -899,10 +899,9 @@ void CGOpenMPRuntimeGPU::emitProcBindClause(CodeGenFunction &CGF,
// Nothing to do.
}
-void CGOpenMPRuntimeGPU::emitNumThreadsClause(
- CodeGenFunction &CGF, llvm::Value *NumThreads, SourceLocation Loc,
- OpenMPNumThreadsClauseModifier Modifier, OpenMPSeverityClauseKind Severity,
- const Expr *Message) {
+void CGOpenMPRuntimeGPU::emitNumThreadsClause(CodeGenFunction &CGF,
+ llvm::Value *NumThreads,
+ SourceLocation Loc) {
// Nothing to do.
}
@@ -1202,17 +1201,18 @@ 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, OpenMPNumThreadsClauseModifier NumThreadsModifier,
- OpenMPSeverityClauseKind Severity, const Expr *Message) {
+void CGOpenMPRuntimeGPU::emitParallelCall(CodeGenFunction &CGF,
+ SourceLocation Loc,
+ llvm::Function *OutlinedFn,
+ ArrayRef<llvm::Value *> CapturedVars,
+ const Expr *IfCond,
+ llvm::Value *NumThreads) {
if (!CGF.HaveInsertPoint())
return;
- auto &&ParallelGen = [this, Loc, OutlinedFn, CapturedVars, IfCond, NumThreads,
- NumThreadsModifier, Severity, Message](
- CodeGenFunction &CGF, PrePostActionTy &Action) {
+ auto &&ParallelGen = [this, Loc, OutlinedFn, CapturedVars, IfCond,
+ NumThreads](CodeGenFunction &CGF,
+ PrePostActionTy &Action) {
CGBuilderTy &Bld = CGF.Builder;
llvm::Value *NumThreadsVal = NumThreads;
llvm::Function *WFn = WrapperFunctionsMap[OutlinedFn];
@@ -1260,22 +1260,21 @@ void CGOpenMPRuntimeGPU::emitParallelCall(
NumThreadsVal = Bld.CreateZExtOrTrunc(NumThreadsVal, CGF.Int32Ty);
assert(IfCondVal && "Expected a value");
- RuntimeFunction FnID = OMPRTL___kmpc_parallel_51;
llvm::Value *RTLoc = emitUpdateLocation(CGF, Loc);
- llvm::SmallVector<llvm::Value *, 10> Args(
- {RTLoc, getThreadID(CGF, Loc), IfCondVal, NumThreadsVal,
- llvm::ConstantInt::get(CGF.Int32Ty, -1), FnPtr, ID,
- Bld.CreateBitOrPointerCast(CapturedVarsAd...
[truncated]
``````````
</details>
https://github.com/llvm/llvm-project/pull/155809
More information about the Openmp-commits
mailing list