[OPENMP50]Fix handling of clauses in parallel master taskloop directive.

We need to capture correctly the value of num_tasks clause and should
not try to emit the if clause at all in the task region.
This commit is contained in:
Alexey Bataev 2020-02-13 09:21:15 -05:00
parent 715783d415
commit 18789bfe3a
2 changed files with 15 additions and 13 deletions

View File

@ -2018,12 +2018,14 @@ static void emitCommonSimdLoop(CodeGenFunction &CGF, const OMPLoopDirective &S,
BodyCodeGen(CGF); BodyCodeGen(CGF);
}; };
const Expr *IfCond = nullptr; const Expr *IfCond = nullptr;
for (const auto *C : S.getClausesOfKind<OMPIfClause>()) { if (isOpenMPSimdDirective(S.getDirectiveKind())) {
if (CGF.getLangOpts().OpenMP >= 50 && for (const auto *C : S.getClausesOfKind<OMPIfClause>()) {
(C->getNameModifier() == OMPD_unknown || if (CGF.getLangOpts().OpenMP >= 50 &&
C->getNameModifier() == OMPD_simd)) { (C->getNameModifier() == OMPD_unknown ||
IfCond = C->getCondition(); C->getNameModifier() == OMPD_simd)) {
break; IfCond = C->getCondition();
break;
}
} }
} }
if (IfCond) { if (IfCond) {
@ -5682,7 +5684,7 @@ void CodeGenFunction::EmitOMPParallelMasterTaskLoopDirective(
Action.Enter(CGF); Action.Enter(CGF);
CGF.EmitOMPTaskLoopBasedDirective(S); CGF.EmitOMPTaskLoopBasedDirective(S);
}; };
OMPLexicalScope Scope(CGF, S, llvm::None, /*EmitPreInitStmt=*/false); OMPLexicalScope Scope(CGF, S, OMPD_parallel, /*EmitPreInitStmt=*/false);
CGM.getOpenMPRuntime().emitMasterRegion(CGF, TaskLoopCodeGen, CGM.getOpenMPRuntime().emitMasterRegion(CGF, TaskLoopCodeGen,
S.getBeginLoc()); S.getBeginLoc());
}; };

View File

@ -1,10 +1,10 @@
// RUN: %clang_cc1 -verify -triple x86_64-apple-darwin10 -fopenmp -x c++ -emit-llvm %s -o - -femit-all-decls | FileCheck %s // RUN: %clang_cc1 -verify -triple x86_64-apple-darwin10 -fopenmp -fopenmp-version=50 -x c++ -emit-llvm %s -o - | FileCheck %s
// RUN: %clang_cc1 -fopenmp -x c++ -triple x86_64-apple-darwin10 -emit-pch -o %t %s // RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -x c++ -triple x86_64-apple-darwin10 -emit-pch -o %t %s
// RUN: %clang_cc1 -fopenmp -x c++ -triple x86_64-apple-darwin10 -include-pch %t -verify %s -emit-llvm -o - -femit-all-decls | FileCheck %s // RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -x c++ -triple x86_64-apple-darwin10 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s
// RUN: %clang_cc1 -verify -triple x86_64-apple-darwin10 -fopenmp-simd -x c++ -emit-llvm %s -o - -femit-all-decls | FileCheck --check-prefix SIMD-ONLY0 %s // RUN: %clang_cc1 -verify -triple x86_64-apple-darwin10 -fopenmp-simd -fopenmp-version=50 -x c++ -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY0 %s
// RUN: %clang_cc1 -fopenmp-simd -x c++ -triple x86_64-apple-darwin10 -emit-pch -o %t %s // RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -x c++ -triple x86_64-apple-darwin10 -emit-pch -o %t %s
// RUN: %clang_cc1 -fopenmp-simd -x c++ -triple x86_64-apple-darwin10 -include-pch %t -verify %s -emit-llvm -o - -femit-all-decls | FileCheck --check-prefix SIMD-ONLY0 %s // RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -x c++ -triple x86_64-apple-darwin10 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY0 %s
// SIMD-ONLY0-NOT: {{__kmpc|__tgt}} // SIMD-ONLY0-NOT: {{__kmpc|__tgt}}
// expected-no-diagnostics // expected-no-diagnostics
#ifndef HEADER #ifndef HEADER