[PATCH] D83983: [flang][OpenMP] Added support for lowering OpenMP taskwait construct
Sourabh Singh Tomar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 16 13:10:39 PDT 2020
SouraVX created this revision.
SouraVX added reviewers: kiranchandramohan, schweitz, jdoerfert, kiranktp.
SouraVX added a project: Flang.
Herald added subscribers: llvm-commits, sstefan1, guansong, yaxunl.
Herald added a reviewer: DavidTruby.
Herald added a project: LLVM.
This patch lower `!OMP TASKWAIT` construct from PFT to
OpenMPDialect operations.
Construct is lowered with conformance to OpenMP 4.5 spec.
Patch is carved out of following approved PR:
https://github.com/flang-compiler/f18-llvm-project/pull/280
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D83983
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
@@ -41,4 +41,19 @@
EXPECT_EQ(succeeded(barrierOp.verify()), true);
}
+TEST_F(OpenMPLoweringTest, TaskWait) {
+ // Construct a dummy parse tree node for `!OMP taskwait`.
+ struct Fortran::parser::OmpSimpleStandaloneDirective taskWaitDirective(
+ llvm::omp::Directive::OMPD_taskwait);
+
+ // Check and lower the `!OMP taskwait` node to `TaskwaitOp` operation of
+ // OpenMPDialect.
+ EXPECT_EQ(taskWaitDirective.v, llvm::omp::Directive::OMPD_taskwait);
+ auto taskWaitOp = mlirOpBuilder->create<mlir::omp::TaskwaitOp>(
+ mlirOpBuilder->getUnknownLoc());
+
+ EXPECT_EQ(taskWaitOp.getOperationName(), "omp.taskwait");
+ EXPECT_EQ(succeeded(taskWaitOp.verify()), true);
+}
+
// main() from gtest_main
Index: flang/lib/Lower/OpenMP.cpp
===================================================================
--- flang/lib/Lower/OpenMP.cpp
+++ flang/lib/Lower/OpenMP.cpp
@@ -35,7 +35,9 @@
absConv.getCurrentLocation());
break;
case llvm::omp::Directive::OMPD_taskwait:
- TODO();
+ absConv.getFirOpBuilder().create<mlir::omp::TaskwaitOp>(
+ absConv.getCurrentLocation());
+ break;
case llvm::omp::Directive::OMPD_taskyield:
TODO();
case llvm::omp::Directive::OMPD_target_enter_data:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D83983.278590.patch
Type: text/x-patch
Size: 1458 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200716/47990942/attachment.bin>
More information about the llvm-commits
mailing list