[flang][OpenMP] Added support for lowering OpenMP taskyield construct

Summary:
This patch lower `!OMP TASKYIELD` construct from PFT to
OpenMPDialect operations.
Construct is lowered with conformance to OpenMP 5.0 spec.

Patch is carved out of following merged PR:
https://github.com/flang-compiler/f18-llvm-project/pull/297

Reviewed: kiranchandramohan

Differential Revision: https://reviews.llvm.org/D84350
This commit is contained in:
Sourabh Singh Tomar 2020-07-22 23:39:54 +05:30
parent b27ab9ce74
commit 9e4ab439c2
2 changed files with 18 additions and 1 deletions

View File

@ -39,7 +39,9 @@ static void genOMP(Fortran::lower::AbstractConverter &absConv,
absConv.getCurrentLocation());
break;
case llvm::omp::Directive::OMPD_taskyield:
TODO();
absConv.getFirOpBuilder().create<mlir::omp::TaskyieldOp>(
absConv.getCurrentLocation());
break;
case llvm::omp::Directive::OMPD_target_enter_data:
TODO();
case llvm::omp::Directive::OMPD_target_exit_data:

View File

@ -56,4 +56,19 @@ TEST_F(OpenMPLoweringTest, TaskWait) {
EXPECT_EQ(succeeded(taskWaitOp.verify()), true);
}
TEST_F(OpenMPLoweringTest, TaskYield) {
// Construct a dummy parse tree node for `!OMP taskyield`.
struct Fortran::parser::OmpSimpleStandaloneDirective taskYieldDirective(
llvm::omp::Directive::OMPD_taskyield);
// Check and lower the `!OMP taskyield` node to `TaskYieldOp` operation of
// OpenMPDialect.
EXPECT_EQ(taskYieldDirective.v, llvm::omp::Directive::OMPD_taskyield);
auto taskYieldOp = mlirOpBuilder->create<mlir::omp::TaskyieldOp>(
mlirOpBuilder->getUnknownLoc());
EXPECT_EQ(taskYieldOp.getOperationName(), "omp.taskyield");
EXPECT_EQ(succeeded(taskYieldOp.verify()), true);
}
// main() from gtest_main