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

via flang-commits flang-commits at lists.llvm.org
Thu Dec 7 07:41:07 PST 2023


Author: Krzysztof Parzyszek
Date: 2023-12-07T09:41:02-06:00
New Revision: 04c4566ca19c054c26460a14270086f1fbaf9abd

URL: https://github.com/llvm/llvm-project/commit/04c4566ca19c054c26460a14270086f1fbaf9abd
DIFF: https://github.com/llvm/llvm-project/commit/04c4566ca19c054c26460a14270086f1fbaf9abd.diff

LOG: [flang] Use `genOpenMPTerminator` to insert terminator (#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.

Added: 
    

Modified: 
    flang/lib/Lower/OpenMP.cpp

Removed: 
    


################################################################################
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