[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 18:47:54 PDT 2020


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

Repository:
  rG LLVM Github Monorepo

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

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.279998.patch
Type: text/x-patch
Size: 1481 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200723/200ef849/attachment.bin>


More information about the llvm-commits mailing list