Skip to content

Commit d2f1f53

Browse files
committed
[flang][OpenMP] Place the insertion point to the start of the block
After skeleton of the `Parallel Op` is created set the insertion point to start of the block. So that later `CodeGen` can proceed. Note: This patch reflects the work that can be upstreamed from PR(merged) PR: flang-compiler#424 Reviewed By: schweitz, kiranchandramohan Differential Revision: https://reviews.llvm.org/D88221
1 parent 55c4ff9 commit d2f1f53

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

flang/lib/Lower/OpenMP.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ genOMP(Fortran::lower::AbstractConverter &converter,
8787
if (parallelDirective.v == llvm::omp::OMPD_parallel) {
8888
auto &firOpBuilder = converter.getFirOpBuilder();
8989
auto currentLocation = converter.getCurrentLocation();
90-
auto insertPt = firOpBuilder.saveInsertionPoint();
9190

9291
// Clauses.
9392
// FIXME: Add support for other clauses.
@@ -117,7 +116,9 @@ genOMP(Fortran::lower::AbstractConverter &converter,
117116
firOpBuilder.setInsertionPointToStart(&block);
118117
// Ensure the block is well-formed.
119118
firOpBuilder.create<mlir::omp::TerminatorOp>(currentLocation);
120-
firOpBuilder.restoreInsertionPoint(insertPt);
119+
120+
// Place the insertion point to the start of the first block.
121+
firOpBuilder.setInsertionPointToStart(&block);
121122
}
122123
}
123124

0 commit comments

Comments
 (0)