diff --git a/clang/lib/CodeGen/CGStmtOpenMP.cpp b/clang/lib/CodeGen/CGStmtOpenMP.cpp --- a/clang/lib/CodeGen/CGStmtOpenMP.cpp +++ b/clang/lib/CodeGen/CGStmtOpenMP.cpp @@ -3866,82 +3866,56 @@ } void CodeGenFunction::EmitOMPMasterDirective(const OMPMasterDirective &S) { - if (CGM.getLangOpts().OpenMPIRBuilder) { - llvm::OpenMPIRBuilder &OMPBuilder = CGM.getOpenMPRuntime().getOMPBuilder(); - using InsertPointTy = llvm::OpenMPIRBuilder::InsertPointTy; - - const Stmt *MasterRegionBodyStmt = S.getAssociatedStmt(); + llvm::OpenMPIRBuilder &OMPBuilder = CGM.getOpenMPRuntime().getOMPBuilder(); + using InsertPointTy = llvm::OpenMPIRBuilder::InsertPointTy; - auto FiniCB = [this](InsertPointTy IP) { - OMPBuilderCBHelpers::FinalizeOMPRegion(*this, IP); - }; + const Stmt *MasterRegionBodyStmt = S.getAssociatedStmt(); - auto BodyGenCB = [MasterRegionBodyStmt, this](InsertPointTy AllocaIP, - InsertPointTy CodeGenIP, - llvm::BasicBlock &FiniBB) { - OMPBuilderCBHelpers::InlinedRegionBodyRAII IRB(*this, AllocaIP, FiniBB); - OMPBuilderCBHelpers::EmitOMPRegionBody(*this, MasterRegionBodyStmt, - CodeGenIP, FiniBB); - }; + auto FiniCB = [this](InsertPointTy IP) { + OMPBuilderCBHelpers::FinalizeOMPRegion(*this, IP); + }; - LexicalScope Scope(*this, S.getSourceRange()); - EmitStopPoint(&S); - Builder.restoreIP(OMPBuilder.createMaster(Builder, BodyGenCB, FiniCB)); + auto BodyGenCB = [MasterRegionBodyStmt, this](InsertPointTy AllocaIP, + InsertPointTy CodeGenIP, + llvm::BasicBlock &FiniBB) { + OMPBuilderCBHelpers::InlinedRegionBodyRAII IRB(*this, AllocaIP, FiniBB); + OMPBuilderCBHelpers::EmitOMPRegionBody(*this, MasterRegionBodyStmt, + CodeGenIP, FiniBB); + }; - return; - } LexicalScope Scope(*this, S.getSourceRange()); EmitStopPoint(&S); - emitMaster(*this, S); -} - -static void emitMasked(CodeGenFunction &CGF, const OMPExecutableDirective &S) { - auto &&CodeGen = [&S](CodeGenFunction &CGF, PrePostActionTy &Action) { - Action.Enter(CGF); - CGF.EmitStmt(S.getRawStmt()); - }; - Expr *Filter = nullptr; - if (const auto *FilterClause = S.getSingleClause()) - Filter = FilterClause->getThreadID(); - CGF.CGM.getOpenMPRuntime().emitMaskedRegion(CGF, CodeGen, S.getBeginLoc(), - Filter); + Builder.restoreIP(OMPBuilder.createMaster(Builder, BodyGenCB, FiniCB)); } void CodeGenFunction::EmitOMPMaskedDirective(const OMPMaskedDirective &S) { - if (CGM.getLangOpts().OpenMPIRBuilder) { - llvm::OpenMPIRBuilder &OMPBuilder = CGM.getOpenMPRuntime().getOMPBuilder(); - using InsertPointTy = llvm::OpenMPIRBuilder::InsertPointTy; - - const Stmt *MaskedRegionBodyStmt = S.getAssociatedStmt(); - const Expr *Filter = nullptr; - if (const auto *FilterClause = S.getSingleClause()) - Filter = FilterClause->getThreadID(); - llvm::Value *FilterVal = Filter - ? EmitScalarExpr(Filter, CGM.Int32Ty) - : llvm::ConstantInt::get(CGM.Int32Ty, /*V=*/0); + llvm::OpenMPIRBuilder &OMPBuilder = CGM.getOpenMPRuntime().getOMPBuilder(); + using InsertPointTy = llvm::OpenMPIRBuilder::InsertPointTy; - auto FiniCB = [this](InsertPointTy IP) { - OMPBuilderCBHelpers::FinalizeOMPRegion(*this, IP); - }; + const Stmt *MaskedRegionBodyStmt = S.getAssociatedStmt(); + const Expr *Filter = nullptr; + if (const auto *FilterClause = S.getSingleClause()) + Filter = FilterClause->getThreadID(); + llvm::Value *FilterVal = Filter + ? EmitScalarExpr(Filter, CGM.Int32Ty) + : llvm::ConstantInt::get(CGM.Int32Ty, /*V=*/0); - auto BodyGenCB = [MaskedRegionBodyStmt, this](InsertPointTy AllocaIP, - InsertPointTy CodeGenIP, - llvm::BasicBlock &FiniBB) { - OMPBuilderCBHelpers::InlinedRegionBodyRAII IRB(*this, AllocaIP, FiniBB); - OMPBuilderCBHelpers::EmitOMPRegionBody(*this, MaskedRegionBodyStmt, - CodeGenIP, FiniBB); - }; + auto FiniCB = [this](InsertPointTy IP) { + OMPBuilderCBHelpers::FinalizeOMPRegion(*this, IP); + }; - LexicalScope Scope(*this, S.getSourceRange()); - EmitStopPoint(&S); - Builder.restoreIP( - OMPBuilder.createMasked(Builder, BodyGenCB, FiniCB, FilterVal)); + auto BodyGenCB = [MaskedRegionBodyStmt, this](InsertPointTy AllocaIP, + InsertPointTy CodeGenIP, + llvm::BasicBlock &FiniBB) { + OMPBuilderCBHelpers::InlinedRegionBodyRAII IRB(*this, AllocaIP, FiniBB); + OMPBuilderCBHelpers::EmitOMPRegionBody(*this, MaskedRegionBodyStmt, + CodeGenIP, FiniBB); + }; - return; - } LexicalScope Scope(*this, S.getSourceRange()); EmitStopPoint(&S); - emitMasked(*this, S); + Builder.restoreIP( + OMPBuilder.createMasked(Builder, BodyGenCB, FiniCB, FilterVal)); } void CodeGenFunction::EmitOMPCriticalDirective(const OMPCriticalDirective &S) { diff --git a/clang/test/OpenMP/masked_codegen.cpp b/clang/test/OpenMP/masked_codegen.cpp --- a/clang/test/OpenMP/masked_codegen.cpp +++ b/clang/test/OpenMP/masked_codegen.cpp @@ -1,10 +1,7 @@ -// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=51 -x c++ -emit-llvm %s -fexceptions -fcxx-exceptions -o - | FileCheck %s --check-prefixes=ALL,NORMAL +// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=51 -x c++ -emit-llvm %s -fexceptions -fcxx-exceptions -o - | FileCheck %s // RUN: %clang_cc1 -fopenmp -fopenmp-version=51 -x c++ -std=c++11 -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=51 -x c++ -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefixes=ALL,NORMAL +// RUN: %clang_cc1 -fopenmp -fopenmp-version=51 -x c++ -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s // RUN: %clang_cc1 -verify -triple x86_64-apple-darwin10 -fopenmp -fopenmp-version=51 -fexceptions -fcxx-exceptions -debug-info-kind=line-tables-only -x c++ -emit-llvm %s -o - | FileCheck %s --check-prefix=TERM_DEBUG -// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=51 -fopenmp-enable-irbuilder -x c++ -emit-llvm %s -fexceptions -fcxx-exceptions -o - | FileCheck %s --check-prefixes=ALL,IRBUILDER -// RUN: %clang_cc1 -fopenmp -fopenmp-version=51 -fopenmp-enable-irbuilder -x c++ -std=c++11 -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=51 -fopenmp-enable-irbuilder -x c++ -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefixes=ALL,IRBUILDER // RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=51 -x c++ -emit-llvm %s -fexceptions -fcxx-exceptions -o - | FileCheck --check-prefix SIMD-ONLY0 %s // RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=51 -x c++ -std=c++11 -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -emit-pch -o %t %s @@ -15,68 +12,66 @@ #ifndef HEADER #define HEADER -// ALL: [[IDENT_T_TY:%.+]] = type { i32, i32, i32, i32, i8* } +// CHECK: [[IDENT_T_TY:%.+]] = type { i32, i32, i32, i32, i8* } -// ALL: define {{.*}}void [[FOO:@.+]]() +// CHECK: define {{.*}}void [[FOO:@.+]]() void foo() { extern void mayThrow(); mayThrow(); } -// ALL-LABEL: @main +// CHECK-LABEL: @main // TERM_DEBUG-LABEL: @main int main() { - // ALL: [[A_ADDR:%.+]] = alloca i8 + // CHECK: [[A_ADDR:%.+]] = alloca i8 char a; -// ALL: [[GTID:%.+]] = call {{.*}}i32 @__kmpc_global_thread_num([[IDENT_T_TY]]* [[DEFAULT_LOC:@.+]]) -// ALL: [[RES:%.+]] = call {{.*}}i32 @__kmpc_masked([[IDENT_T_TY]]* [[DEFAULT_LOC]], i32 [[GTID]], i32 0) -// ALL-NEXT: [[IS_MASKED:%.+]] = icmp ne i32 [[RES]], 0 -// ALL-NEXT: br i1 [[IS_MASKED]], label {{%?}}[[THEN:.+]], label {{%?}}[[EXIT:.+]] -// ALL: [[THEN]] -// ALL-NEXT: store i8 2, i8* [[A_ADDR]] -// ALL-NEXT: call {{.*}}void @__kmpc_end_masked([[IDENT_T_TY]]* [[DEFAULT_LOC]], i32 [[GTID]]) -// ALL-NEXT: br label {{%?}}[[EXIT]] -// ALL: [[EXIT]] +// CHECK: [[GTID:%.+]] = call {{.*}}i32 @__kmpc_global_thread_num([[IDENT_T_TY]]* [[DEFAULT_LOC:@.+]]) +// CHECK: [[RES:%.+]] = call {{.*}}i32 @__kmpc_masked([[IDENT_T_TY]]* [[DEFAULT_LOC]], i32 [[GTID]], i32 0) +// CHECK-NEXT: [[IS_MASKED:%.+]] = icmp ne i32 [[RES]], 0 +// CHECK-NEXT: br i1 [[IS_MASKED]], label {{%?}}[[THEN:.+]], label {{%?}}[[EXIT:.+]] +// CHECK: [[THEN]] +// CHECK-NEXT: store i8 2, i8* [[A_ADDR]] +// CHECK-NEXT: call {{.*}}void @__kmpc_end_masked([[IDENT_T_TY]]* [[DEFAULT_LOC]], i32 [[GTID]]) +// CHECK-NEXT: br label {{%?}}[[EXIT]] +// CHECK: [[EXIT]] #pragma omp masked a = 2; -// IRBUILDER: [[GTID:%.+]] = call {{.*}}i32 @__kmpc_global_thread_num([[IDENT_T_TY]]* [[DEFAULT_LOC:@.+]]) -// ALL: [[RES:%.+]] = call {{.*}}i32 @__kmpc_masked([[IDENT_T_TY]]* [[DEFAULT_LOC]], i32 [[GTID]], i32 2) -// ALL-NEXT: [[IS_MASKED:%.+]] = icmp ne i32 [[RES]], 0 -// ALL-NEXT: br i1 [[IS_MASKED]], label {{%?}}[[THEN:.+]], label {{%?}}[[EXIT:.+]] -// ALL: [[THEN]] -// IRBUILDER-NEXT: call {{.*}}void [[FOO]]() -// NORMAL-NEXT: invoke {{.*}}void [[FOO]]() -// ALL: call {{.*}}void @__kmpc_end_masked([[IDENT_T_TY]]* [[DEFAULT_LOC]], i32 [[GTID]]) -// ALL-NEXT: br label {{%?}}[[EXIT]] -// ALL: [[EXIT]] +// CHECK: [[GTID:%.+]] = call {{.*}}i32 @__kmpc_global_thread_num([[IDENT_T_TY]]* [[DEFAULT_LOC:@.+]]) +// CHECK: [[RES:%.+]] = call {{.*}}i32 @__kmpc_masked([[IDENT_T_TY]]* [[DEFAULT_LOC]], i32 [[GTID]], i32 2) +// CHECK-NEXT: [[IS_MASKED:%.+]] = icmp ne i32 [[RES]], 0 +// CHECK-NEXT: br i1 [[IS_MASKED]], label {{%?}}[[THEN:.+]], label {{%?}}[[EXIT:.+]] +// CHECK: [[THEN]] +// CHECK-NEXT: call {{.*}}void [[FOO]]() +// CHECK: call {{.*}}void @__kmpc_end_masked([[IDENT_T_TY]]* [[DEFAULT_LOC]], i32 [[GTID]]) +// CHECK-NEXT: br label {{%?}}[[EXIT]] +// CHECK: [[EXIT]] #pragma omp masked filter(2) foo(); -// ALL: store i32 9, i32* [[X:.+]], -// ALL: [[X_VAL:%.+]] = load i32, i32* [[X]] -// IRBUILDER: [[GTID:%.+]] = call {{.*}}i32 @__kmpc_global_thread_num([[IDENT_T_TY]]* [[DEFAULT_LOC:@.+]]) -// ALL: [[RES:%.+]] = call {{.*}}i32 @__kmpc_masked([[IDENT_T_TY]]* [[DEFAULT_LOC]], i32 [[GTID]], i32 [[X_VAL]]) -// ALL-NEXT: [[IS_MASKED:%.+]] = icmp ne i32 [[RES]], 0 -// ALL-NEXT: br i1 [[IS_MASKED]], label {{%?}}[[THEN:.+]], label {{%?}}[[EXIT:.+]] -// ALL: [[THEN]] -// IRBUILDER-NEXT: call {{.*}}void [[FOO]]() -// NORMAL-NEXT: invoke {{.*}}void [[FOO]]() -// ALL: call {{.*}}void @__kmpc_end_masked([[IDENT_T_TY]]* [[DEFAULT_LOC]], i32 [[GTID]]) -// ALL-NEXT: br label {{%?}}[[EXIT]] -// ALL: [[EXIT]] +// CHECK: store i32 9, i32* [[X:.+]], +// CHECK: [[X_VAL:%.+]] = load i32, i32* [[X]] +// CHECK: [[GTID:%.+]] = call {{.*}}i32 @__kmpc_global_thread_num([[IDENT_T_TY]]* [[DEFAULT_LOC:@.+]]) +// CHECK: [[RES:%.+]] = call {{.*}}i32 @__kmpc_masked([[IDENT_T_TY]]* [[DEFAULT_LOC]], i32 [[GTID]], i32 [[X_VAL]]) +// CHECK-NEXT: [[IS_MASKED:%.+]] = icmp ne i32 [[RES]], 0 +// CHECK-NEXT: br i1 [[IS_MASKED]], label {{%?}}[[THEN:.+]], label {{%?}}[[EXIT:.+]] +// CHECK: [[THEN]] +// CHECK-NEXT: call {{.*}}void [[FOO]]() +// CHECK: call {{.*}}void @__kmpc_end_masked([[IDENT_T_TY]]* [[DEFAULT_LOC]], i32 [[GTID]]) +// CHECK-NEXT: br label {{%?}}[[EXIT]] +// CHECK: [[EXIT]] int x = 9; #pragma omp masked filter(x) foo(); - // ALL-NOT: call i32 @__kmpc_masked - // ALL-NOT: call void @__kmpc_end_masked + // CHECK-NOT: call i32 @__kmpc_masked + // CHECK-NOT: call void @__kmpc_end_masked return a; } -// ALL-LABEL: lambda_masked +// CHECK-LABEL: lambda_masked // TERM_DEBUG-LABEL: lambda_masked void lambda_masked(int a, int b) { auto l = [=]() { #pragma omp masked { - // ALL: call i32 @__kmpc_masked( + // CHECK: call i32 @__kmpc_masked( int c = a + b; } }; @@ -87,7 +82,7 @@ #pragma omp parallel #pragma omp masked filter(1) { - // ALL: call i32 @__kmpc_masked( + // CHECK: call i32 @__kmpc_masked( int c = a + b; } }; @@ -99,7 +94,7 @@ #pragma omp parallel #pragma omp masked filter(yy) { - // ALL: call i32 @__kmpc_masked( + // CHECK: call i32 @__kmpc_masked( int c = a + b; } }; @@ -107,12 +102,12 @@ l2(y); } -// ALL-LABEL: parallel_masked +// CHECK-LABEL: parallel_masked // TERM_DEBUG-LABEL: parallel_masked void parallel_masked() { #pragma omp parallel #pragma omp masked filter(1) - // TERM_DEBUG-NOT: __kmpc_global_thread_num + // TERM_DEBUG: __kmpc_global_thread_num // TERM_DEBUG: call i32 @__kmpc_masked({{.+}}), !dbg [[DBG_LOC_START:![0-9]+]] // TERM_DEBUG: invoke void {{.*}}foo{{.*}}() // TERM_DEBUG: unwind label %[[TERM_LPAD:.+]], @@ -126,7 +121,7 @@ int x; #pragma omp parallel #pragma omp masked filter(x) - // TERM_DEBUG-NOT: __kmpc_global_thread_num + // TERM_DEBUG: __kmpc_global_thread_num // TERM_DEBUG: call i32 @__kmpc_masked({{.+}}), !dbg [[DBG_LOC_START:![0-9]+]] // TERM_DEBUG: invoke void {{.*}}foo{{.*}}() // TERM_DEBUG: unwind label %[[TERM_LPAD:.+]], diff --git a/clang/test/OpenMP/master_codegen.cpp b/clang/test/OpenMP/master_codegen.cpp --- a/clang/test/OpenMP/master_codegen.cpp +++ b/clang/test/OpenMP/master_codegen.cpp @@ -1,10 +1,7 @@ -// RUN: %clang_cc1 -verify -fopenmp -x c++ -emit-llvm %s -fexceptions -fcxx-exceptions -o - | FileCheck %s --check-prefixes=ALL,NORMAL +// RUN: %clang_cc1 -verify -fopenmp -x c++ -emit-llvm %s -fexceptions -fcxx-exceptions -o - | FileCheck %s // RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -x c++ -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefixes=ALL,NORMAL +// RUN: %clang_cc1 -fopenmp -x c++ -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s // RUN: %clang_cc1 -verify -triple x86_64-apple-darwin10 -fopenmp -fexceptions -fcxx-exceptions -debug-info-kind=line-tables-only -x c++ -emit-llvm %s -o - | FileCheck %s --check-prefix=TERM_DEBUG -// RUN: %clang_cc1 -verify -fopenmp -fopenmp-enable-irbuilder -x c++ -emit-llvm %s -fexceptions -fcxx-exceptions -o - | FileCheck %s --check-prefixes=ALL,IRBUILDER -// RUN: %clang_cc1 -fopenmp -fopenmp-enable-irbuilder -x c++ -std=c++11 -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-enable-irbuilder -x c++ -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefixes=ALL,IRBUILDER // RUN: %clang_cc1 -verify -fopenmp-simd -x c++ -emit-llvm %s -fexceptions -fcxx-exceptions -o - | FileCheck --check-prefix SIMD-ONLY0 %s // RUN: %clang_cc1 -fopenmp-simd -x c++ -std=c++11 -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -emit-pch -o %t %s @@ -15,53 +12,52 @@ #ifndef HEADER #define HEADER -// ALL: [[IDENT_T_TY:%.+]] = type { i32, i32, i32, i32, i8* } +// CHECK: [[IDENT_T_TY:%.+]] = type { i32, i32, i32, i32, i8* } -// ALL: define {{.*}}void [[FOO:@.+]]() +// CHECK: define {{.*}}void [[FOO:@.+]]() void foo() { extern void mayThrow(); mayThrow(); } -// ALL-LABEL: @main +// CHECK-LABEL: @main // TERM_DEBUG-LABEL: @main int main() { - // ALL: [[A_ADDR:%.+]] = alloca i8 + // CHECK: [[A_ADDR:%.+]] = alloca i8 char a; -// ALL: [[GTID:%.+]] = call {{.*}}i32 @__kmpc_global_thread_num([[IDENT_T_TY]]* [[DEFAULT_LOC:@.+]]) -// ALL: [[RES:%.+]] = call {{.*}}i32 @__kmpc_master([[IDENT_T_TY]]* [[DEFAULT_LOC]], i32 [[GTID]]) -// ALL-NEXT: [[IS_MASTER:%.+]] = icmp ne i32 [[RES]], 0 -// ALL-NEXT: br i1 [[IS_MASTER]], label {{%?}}[[THEN:.+]], label {{%?}}[[EXIT:.+]] -// ALL: [[THEN]] -// ALL-NEXT: store i8 2, i8* [[A_ADDR]] -// ALL-NEXT: call {{.*}}void @__kmpc_end_master([[IDENT_T_TY]]* [[DEFAULT_LOC]], i32 [[GTID]]) -// ALL-NEXT: br label {{%?}}[[EXIT]] -// ALL: [[EXIT]] +// CHECK: [[GTID:%.+]] = call {{.*}}i32 @__kmpc_global_thread_num([[IDENT_T_TY]]* [[DEFAULT_LOC:@.+]]) +// CHECK: [[RES:%.+]] = call {{.*}}i32 @__kmpc_master([[IDENT_T_TY]]* [[DEFAULT_LOC]], i32 [[GTID]]) +// CHECK-NEXT: [[IS_MASTER:%.+]] = icmp ne i32 [[RES]], 0 +// CHECK-NEXT: br i1 [[IS_MASTER]], label {{%?}}[[THEN:.+]], label {{%?}}[[EXIT:.+]] +// CHECK: [[THEN]] +// CHECK-NEXT: store i8 2, i8* [[A_ADDR]] +// CHECK-NEXT: call {{.*}}void @__kmpc_end_master([[IDENT_T_TY]]* [[DEFAULT_LOC]], i32 [[GTID]]) +// CHECK-NEXT: br label {{%?}}[[EXIT]] +// CHECK: [[EXIT]] #pragma omp master a = 2; -// IRBUILDER: [[GTID:%.+]] = call {{.*}}i32 @__kmpc_global_thread_num([[IDENT_T_TY]]* [[DEFAULT_LOC:@.+]]) -// ALL: [[RES:%.+]] = call {{.*}}i32 @__kmpc_master([[IDENT_T_TY]]* [[DEFAULT_LOC]], i32 [[GTID]]) -// ALL-NEXT: [[IS_MASTER:%.+]] = icmp ne i32 [[RES]], 0 -// ALL-NEXT: br i1 [[IS_MASTER]], label {{%?}}[[THEN:.+]], label {{%?}}[[EXIT:.+]] -// ALL: [[THEN]] -// IRBUILDER-NEXT: call {{.*}}void [[FOO]]() -// NORMAL-NEXT: invoke {{.*}}void [[FOO]]() -// ALL: call {{.*}}void @__kmpc_end_master([[IDENT_T_TY]]* [[DEFAULT_LOC]], i32 [[GTID]]) -// ALL-NEXT: br label {{%?}}[[EXIT]] -// ALL: [[EXIT]] +// CHECK: [[GTID:%.+]] = call {{.*}}i32 @__kmpc_global_thread_num([[IDENT_T_TY]]* [[DEFAULT_LOC:@.+]]) +// CHECK: [[RES:%.+]] = call {{.*}}i32 @__kmpc_master([[IDENT_T_TY]]* [[DEFAULT_LOC]], i32 [[GTID]]) +// CHECK-NEXT: [[IS_MASTER:%.+]] = icmp ne i32 [[RES]], 0 +// CHECK-NEXT: br i1 [[IS_MASTER]], label {{%?}}[[THEN:.+]], label {{%?}}[[EXIT:.+]] +// CHECK: [[THEN]] +// CHECK-NEXT: call {{.*}}void [[FOO]]() +// CHECK: call {{.*}}void @__kmpc_end_master([[IDENT_T_TY]]* [[DEFAULT_LOC]], i32 [[GTID]]) +// CHECK-NEXT: br label {{%?}}[[EXIT]] +// CHECK: [[EXIT]] #pragma omp master foo(); - // ALL-NOT: call i32 @__kmpc_master - // ALL-NOT: call void @__kmpc_end_master + // CHECK-NOT: call i32 @__kmpc_master + // CHECK-NOT: call void @__kmpc_end_master return a; } -// ALL-LABEL: lambda_master +// CHECK-LABEL: lambda_master // TERM_DEBUG-LABEL: lambda_master void lambda_master(int a, int b) { auto l = [=]() { #pragma omp master { - // ALL: call i32 @__kmpc_master( + // CHECK: call i32 @__kmpc_master( int c = a + b; } }; @@ -72,7 +68,7 @@ #pragma omp parallel #pragma omp master { - // ALL: call i32 @__kmpc_master( + // CHECK: call i32 @__kmpc_master( int c = a + b; } }; @@ -82,7 +78,7 @@ auto l2 = [=]() { #pragma omp parallel master { - // ALL: call i32 @__kmpc_master( + // CHECK: call i32 @__kmpc_master( int c = a + b; } }; @@ -90,12 +86,12 @@ l2(); } -// ALL-LABEL: parallel_master +// CHECK-LABEL: parallel_master // TERM_DEBUG-LABEL: parallel_master void parallel_master() { #pragma omp parallel #pragma omp master - // TERM_DEBUG-NOT: __kmpc_global_thread_num + // TERM_DEBUG: __kmpc_global_thread_num // TERM_DEBUG: call i32 @__kmpc_master({{.+}}), !dbg [[DBG_LOC_START:![0-9]+]] // TERM_DEBUG: invoke void {{.*}}foo{{.*}}() // TERM_DEBUG: unwind label %[[TERM_LPAD:.+]],