[flang-commits] [flang] [flang] Use `genOpenMPTerminator` to insert terminator (PR #74719)
Krzysztof Parzyszek via flang-commits
flang-commits at lists.llvm.org
Thu Dec 7 06:31:22 PST 2023
https://github.com/kparzysz created https://github.com/llvm/llvm-project/pull/74719
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.
>From ade48bf6e203adb6a03b13a2499d32966edabee2 Mon Sep 17 00:00:00 2001
From: Krzysztof Parzyszek <Krzysztof.Parzyszek at amd.com>
Date: Thu, 7 Dec 2023 08:24:31 -0600
Subject: [PATCH] [flang] Use `genOpenMPTerminator` to insert terminator
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.
---
flang/lib/Lower/OpenMP.cpp | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
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);
More information about the flang-commits
mailing list