Skip to content

Commit 3c92ad9

Browse files
skatrakkbluck
authored andcommitted
[Flang][OpenMP] Use InsertionGuard in DataSharingProcessor (llvm#97562)
This patch removes the introduction of `fir.undef` operations as a way to keep track of insertion points inside of the `DataSharingProcessor`, and it replaces them with an `InsertionGuard` to avoid creating such operations inside of loop wrappers. Leaving any `fir.undef` operation inside of a loop wrapper would result in a verifier error, since they enforce strict requirements on the contents of their code regions.
1 parent bb79a6c commit 3c92ad9

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

flang/lib/Lower/OpenMP/DataSharingProcessor.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,8 @@ void DataSharingProcessor::processStep2(mlir::Operation *op, bool isLoop) {
7272
firOpBuilder.setInsertionPointAfter(op);
7373
insertDeallocs();
7474
} else {
75-
// insert dummy instruction to mark the insertion position
76-
mlir::Value undefMarker = firOpBuilder.create<fir::UndefOp>(
77-
op->getLoc(), firOpBuilder.getIndexType());
75+
mlir::OpBuilder::InsertionGuard guard(firOpBuilder);
7876
insertDeallocs();
79-
firOpBuilder.setInsertionPointAfter(undefMarker.getDefiningOp());
8077
}
8178
}
8279

0 commit comments

Comments
 (0)