@@ -1845,11 +1845,11 @@ void CGOpenMPRuntime::emitIfClause(CodeGenFunction &CGF, const Expr *Cond,
18451845  CGF.EmitBlock(ContBlock, /*IsFinished=*/true);
18461846}
18471847
1848- void CGOpenMPRuntime::emitParallelCall(
1849-     CodeGenFunction &CGF, SourceLocation Loc,  llvm::Function *OutlinedFn,
1850-     ArrayRef<llvm::Value *> CapturedVars, const Expr *IfCond ,
1851-     llvm::Value *NumThreads, OpenMPNumThreadsClauseModifier NumThreadsModifier ,
1852-     OpenMPSeverityClauseKind Severity, const Expr *Message ) {
1848+ void CGOpenMPRuntime::emitParallelCall(CodeGenFunction &CGF, SourceLocation Loc, 
1849+                                         llvm::Function *OutlinedFn,
1850+                                         ArrayRef<llvm::Value *> CapturedVars,
1851+                                        const Expr *IfCond ,
1852+                                        llvm::Value *NumThreads ) {
18531853  if (!CGF.HaveInsertPoint())
18541854    return;
18551855  llvm::Value *RTLoc = emitUpdateLocation(CGF, Loc);
@@ -2372,8 +2372,9 @@ void CGOpenMPRuntime::emitBarrierCall(CodeGenFunction &CGF, SourceLocation Loc,
23722372
23732373void CGOpenMPRuntime::emitErrorCall(CodeGenFunction &CGF, SourceLocation Loc,
23742374                                    Expr *ME, bool IsFatal) {
2375-   llvm::Value *MVL = ME ? CGF.EmitScalarExpr(ME)
2376-                         : llvm::ConstantPointerNull::get(CGF.VoidPtrTy);
2375+   llvm::Value *MVL =
2376+       ME ? CGF.EmitStringLiteralLValue(cast<StringLiteral>(ME)).getPointer(CGF)
2377+          : llvm::ConstantPointerNull::get(CGF.VoidPtrTy);
23772378  // Build call void __kmpc_error(ident_t *loc, int severity, const char
23782379  // *message)
23792380  llvm::Value *Args[] = {
@@ -2698,54 +2699,18 @@ llvm::Value *CGOpenMPRuntime::emitForNext(CodeGenFunction &CGF,
26982699      CGF.getContext().BoolTy, Loc);
26992700}
27002701
2701- llvm::Value *CGOpenMPRuntime::emitMessageClause(CodeGenFunction &CGF,
2702-                                                 const Expr *Message) {
2703-   if (!Message)
2704-     return llvm::ConstantPointerNull::get(CGF.VoidPtrTy);
2705-   return CGF.EmitScalarExpr(Message);
2706- }
2707- 
2708- llvm::Value *
2709- CGOpenMPRuntime::emitMessageClause(CodeGenFunction &CGF,
2710-                                    const OMPMessageClause *MessageClause) {
2711-   return emitMessageClause(
2712-       CGF, MessageClause ? MessageClause->getMessageString() : nullptr);
2713- }
2714- 
2715- llvm::Value *
2716- CGOpenMPRuntime::emitSeverityClause(OpenMPSeverityClauseKind Severity) {
2717-   // OpenMP 6.0, 10.4: "If no severity clause is specified then the effect is
2718-   // as if sev-level is fatal."
2719-   return llvm::ConstantInt::get(CGM.Int32Ty,
2720-                                 Severity == OMPC_SEVERITY_warning ? 1 : 2);
2721- }
2722- 
2723- llvm::Value *
2724- CGOpenMPRuntime::emitSeverityClause(const OMPSeverityClause *SeverityClause) {
2725-   return emitSeverityClause(SeverityClause ? SeverityClause->getSeverityKind()
2726-                                            : OMPC_SEVERITY_unknown);
2727- }
2728- 
2729- void CGOpenMPRuntime::emitNumThreadsClause(
2730-     CodeGenFunction &CGF, llvm::Value *NumThreads, SourceLocation Loc,
2731-     OpenMPNumThreadsClauseModifier Modifier, OpenMPSeverityClauseKind Severity,
2732-     const Expr *Message) {
2702+ void CGOpenMPRuntime::emitNumThreadsClause(CodeGenFunction &CGF,
2703+                                            llvm::Value *NumThreads,
2704+                                            SourceLocation Loc) {
27332705  if (!CGF.HaveInsertPoint())
27342706    return;
2735-   llvm::SmallVector<llvm::Value *, 4> Args(
2736-       {emitUpdateLocation(CGF, Loc), getThreadID(CGF, Loc),
2737-        CGF.Builder.CreateIntCast(NumThreads, CGF.Int32Ty, /*isSigned*/ true)});
27382707  // Build call __kmpc_push_num_threads(&loc, global_tid, num_threads)
2739-   // or __kmpc_push_num_threads_strict(&loc, global_tid, num_threads, severity,
2740-   // messsage) if strict modifier is used.
2741-   RuntimeFunction FnID = OMPRTL___kmpc_push_num_threads;
2742-   if (Modifier == OMPC_NUMTHREADS_strict) {
2743-     FnID = OMPRTL___kmpc_push_num_threads_strict;
2744-     Args.push_back(emitSeverityClause(Severity));
2745-     Args.push_back(emitMessageClause(CGF, Message));
2746-   }
2747-   CGF.EmitRuntimeCall(
2748-       OMPBuilder.getOrCreateRuntimeFunction(CGM.getModule(), FnID), Args);
2708+   llvm::Value *Args[] = {
2709+       emitUpdateLocation(CGF, Loc), getThreadID(CGF, Loc),
2710+       CGF.Builder.CreateIntCast(NumThreads, CGF.Int32Ty, /*isSigned*/ true)};
2711+   CGF.EmitRuntimeCall(OMPBuilder.getOrCreateRuntimeFunction(
2712+                           CGM.getModule(), OMPRTL___kmpc_push_num_threads),
2713+                       Args);
27492714}
27502715
27512716void CGOpenMPRuntime::emitProcBindClause(CodeGenFunction &CGF,
@@ -12149,11 +12114,12 @@ llvm::Function *CGOpenMPSIMDRuntime::emitTaskOutlinedFunction(
1214912114  llvm_unreachable("Not supported in SIMD-only mode");
1215012115}
1215112116
12152- void CGOpenMPSIMDRuntime::emitParallelCall(
12153-     CodeGenFunction &CGF, SourceLocation Loc, llvm::Function *OutlinedFn,
12154-     ArrayRef<llvm::Value *> CapturedVars, const Expr *IfCond,
12155-     llvm::Value *NumThreads, OpenMPNumThreadsClauseModifier NumThreadsModifier,
12156-     OpenMPSeverityClauseKind Severity, const Expr *Message) {
12117+ void CGOpenMPSIMDRuntime::emitParallelCall(CodeGenFunction &CGF,
12118+                                            SourceLocation Loc,
12119+                                            llvm::Function *OutlinedFn,
12120+                                            ArrayRef<llvm::Value *> CapturedVars,
12121+                                            const Expr *IfCond,
12122+                                            llvm::Value *NumThreads) {
1215712123  llvm_unreachable("Not supported in SIMD-only mode");
1215812124}
1215912125
@@ -12256,10 +12222,9 @@ llvm::Value *CGOpenMPSIMDRuntime::emitForNext(CodeGenFunction &CGF,
1225612222  llvm_unreachable("Not supported in SIMD-only mode");
1225712223}
1225812224
12259- void CGOpenMPSIMDRuntime::emitNumThreadsClause(
12260-     CodeGenFunction &CGF, llvm::Value *NumThreads, SourceLocation Loc,
12261-     OpenMPNumThreadsClauseModifier Modifier, OpenMPSeverityClauseKind Severity,
12262-     const Expr *Message) {
12225+ void CGOpenMPSIMDRuntime::emitNumThreadsClause(CodeGenFunction &CGF,
12226+                                                llvm::Value *NumThreads,
12227+                                                SourceLocation Loc) {
1226312228  llvm_unreachable("Not supported in SIMD-only mode");
1226412229}
1226512230
0 commit comments