Skip to content

Commit 04c4566

Browse files
authored
[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.
1 parent 9026dff commit 04c4566

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

flang/lib/Lower/OpenMP.cpp

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2150,13 +2150,7 @@ static void createBodyOfOp(
21502150
firOpBuilder, eval.getNestedEvaluations());
21512151

21522152
// Insert the terminator.
2153-
if constexpr (std::is_same_v<Op, mlir::omp::WsLoopOp> ||
2154-
std::is_same_v<Op, mlir::omp::SimdLoopOp>) {
2155-
mlir::ValueRange results;
2156-
firOpBuilder.create<mlir::omp::YieldOp>(loc, results);
2157-
} else {
2158-
firOpBuilder.create<mlir::omp::TerminatorOp>(loc);
2159-
}
2153+
Fortran::lower::genOpenMPTerminator(firOpBuilder, op.getOperation(), loc);
21602154
// Reset the insert point to before the terminator.
21612155
resetBeforeTerminator(firOpBuilder, storeOp, block);
21622156

0 commit comments

Comments
 (0)