[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
Fri Jul 17 07:32:40 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rG079b49b3fb22: [flang][OpenMP] Added support for lowering OpenMP taskwait construct (authored by SouraVX).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D83983/new/

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.278764.patch
Type: text/x-patch
Size: 1458 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200717/5df792b1/attachment.bin>


More information about the llvm-commits mailing list