[flang-commits] [flang] [flang] Use `genOpenMPTerminator` to insert terminator (PR #74719)

via flang-commits flang-commits at lists.llvm.org
Thu Dec 7 06:31:52 PST 2023


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-flang-openmp

Author: Krzysztof Parzyszek (kparzysz)

<details>
<summary>Changes</summary>

The specific terminator operation depends on what operation it is inside of. The function `genOpenMPTerminator` performs these checks and selects the appropriate type of terminator.

Remove partial duplication of that code, and replace it with a function call. This makes `genOpenMPTerminator` be the sole source of OpenMP terminators.

---
Full diff: https://github.com/llvm/llvm-project/pull/74719.diff


1 Files Affected:

- (modified) flang/lib/Lower/OpenMP.cpp (+1-7) 


``````````diff
diff --git a/flang/lib/Lower/OpenMP.cpp b/flang/lib/Lower/OpenMP.cpp
index 31d5df040c5d6..eeba87fcd1511 100644
--- a/flang/lib/Lower/OpenMP.cpp
+++ b/flang/lib/Lower/OpenMP.cpp
@@ -2150,13 +2150,7 @@ static void createBodyOfOp(
         firOpBuilder, eval.getNestedEvaluations());
 
   // Insert the terminator.
-  if constexpr (std::is_same_v<Op, mlir::omp::WsLoopOp> ||
-                std::is_same_v<Op, mlir::omp::SimdLoopOp>) {
-    mlir::ValueRange results;
-    firOpBuilder.create<mlir::omp::YieldOp>(loc, results);
-  } else {
-    firOpBuilder.create<mlir::omp::TerminatorOp>(loc);
-  }
+  Fortran::lower::genOpenMPTerminator(firOpBuilder, op.getOperation(), loc);
   // Reset the insert point to before the terminator.
   resetBeforeTerminator(firOpBuilder, storeOp, block);
 

``````````

</details>


https://github.com/llvm/llvm-project/pull/74719


More information about the flang-commits mailing list