[PATCH] D84350: [flang][OpenMP] Added support for lowering OpenMP taskyield construct
Sourabh Singh Tomar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 22 11:14:42 PDT 2020
SouraVX created this revision.
SouraVX added reviewers: schweitz, kiranchandramohan, clementval, kiranktp, jdoerfert.
Herald added subscribers: llvm-commits, sstefan1, guansong, yaxunl.
Herald added a reviewer: DavidTruby.
Herald added a project: LLVM.
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 approved PR:
https://github.com/flang-compiler/f18-llvm-project/pull/297
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D84350
Files:
flang/lib/Lower/OpenMP.cpp
flang/unittests/Lower/OpenMPLoweringTest.cpp
Index: flang/unittests/Lower/OpenMPLoweringTest.cpp
===================================================================
--- flang/unittests/Lower/OpenMPLoweringTest.cpp
+++ flang/unittests/Lower/OpenMPLoweringTest.cpp
@@ -56,4 +56,19 @@
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
Index: flang/lib/Lower/OpenMP.cpp
===================================================================
--- flang/lib/Lower/OpenMP.cpp
+++ flang/lib/Lower/OpenMP.cpp
@@ -39,7 +39,9 @@
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:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D84350.279891.patch
Type: text/x-patch
Size: 1481 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200722/c8eb4de7/attachment.bin>
More information about the llvm-commits
mailing list