Skip to content

Commit 664a041

Browse files
committed
GPU codegen doesn't use emitNumThreadsClause -> pass information to emitParallelCall as well
1 parent a0a008c commit 664a041

File tree

3 files changed

+1079
-8
lines changed

3 files changed

+1079
-8
lines changed

clang/lib/CodeGen/CGStmtOpenMP.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1608,6 +1608,11 @@ static void emitCommonOMPParallelDirective(
16081608
const CodeGenBoundParametersTy &CodeGenBoundParameters) {
16091609
const CapturedStmt *CS = S.getCapturedStmt(OMPD_parallel);
16101610
llvm::Value *NumThreads = nullptr;
1611+
OpenMPNumThreadsClauseModifier Modifier = OMPC_NUMTHREADS_unknown;
1612+
// OpenMP 6.0, 10.4: "If no severity clause is specified then the effect is as
1613+
// if sev-level is fatal."
1614+
OpenMPSeverityClauseKind Severity = OMPC_SEVERITY_fatal;
1615+
clang::Expr *Message = nullptr;
16111616
llvm::Function *OutlinedFn =
16121617
CGF.CGM.getOpenMPRuntime().emitParallelOutlinedFunction(
16131618
CGF, S, *CS->getCapturedDecl()->param_begin(), InnermostKind,
@@ -1616,9 +1621,7 @@ static void emitCommonOMPParallelDirective(
16161621
CodeGenFunction::RunCleanupsScope NumThreadsScope(CGF);
16171622
NumThreads = CGF.EmitScalarExpr(NumThreadsClause->getNumThreads(),
16181623
/*IgnoreResultAssign=*/true);
1619-
OpenMPNumThreadsClauseModifier Modifier = NumThreadsClause->getModifier();
1620-
OpenMPSeverityClauseKind Severity = OMPC_SEVERITY_fatal;
1621-
clang::Expr *Message = nullptr;
1624+
Modifier = NumThreadsClause->getModifier();
16221625
if (const auto *MessageClause = S.getSingleClause<OMPMessageClause>())
16231626
Message = MessageClause->getMessageString();
16241627
if (const auto *SeverityClause = S.getSingleClause<OMPSeverityClause>())
@@ -1650,7 +1653,8 @@ static void emitCommonOMPParallelDirective(
16501653
CodeGenBoundParameters(CGF, S, CapturedVars);
16511654
CGF.GenerateOpenMPCapturedVars(*CS, CapturedVars);
16521655
CGF.CGM.getOpenMPRuntime().emitParallelCall(CGF, S.getBeginLoc(), OutlinedFn,
1653-
CapturedVars, IfCond, NumThreads);
1656+
CapturedVars, IfCond, NumThreads,
1657+
Modifier, Severity, Message);
16541658
}
16551659

16561660
static bool isAllocatableDecl(const VarDecl *VD) {

0 commit comments

Comments
 (0)