[flang-commits] [flang] 99f6ff9 - [Flang][OpenMP] Use InsertionGuard in DataSharingProcessor (#97562)
via flang-commits
flang-commits at lists.llvm.org
Thu Jul 4 05:13:24 PDT 2024
Author: Sergio Afonso
Date: 2024-07-04T13:13:21+01:00
New Revision: 99f6ff9c0b5f2c009878c2ad5607bc7a3086956b
URL: https://github.com/llvm/llvm-project/commit/99f6ff9c0b5f2c009878c2ad5607bc7a3086956b
DIFF: https://github.com/llvm/llvm-project/commit/99f6ff9c0b5f2c009878c2ad5607bc7a3086956b.diff
LOG: [Flang][OpenMP] Use InsertionGuard in DataSharingProcessor (#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.
Added:
Modified:
flang/lib/Lower/OpenMP/DataSharingProcessor.cpp
Removed:
################################################################################
diff --git a/flang/lib/Lower/OpenMP/DataSharingProcessor.cpp b/flang/lib/Lower/OpenMP/DataSharingProcessor.cpp
index e2b55fcc64062..7df3905c29990 100644
--- a/flang/lib/Lower/OpenMP/DataSharingProcessor.cpp
+++ b/flang/lib/Lower/OpenMP/DataSharingProcessor.cpp
@@ -72,11 +72,8 @@ void DataSharingProcessor::processStep2(mlir::Operation *op, bool isLoop) {
firOpBuilder.setInsertionPointAfter(op);
insertDeallocs();
} else {
- // insert dummy instruction to mark the insertion position
- mlir::Value undefMarker = firOpBuilder.create<fir::UndefOp>(
- op->getLoc(), firOpBuilder.getIndexType());
+ mlir::OpBuilder::InsertionGuard guard(firOpBuilder);
insertDeallocs();
- firOpBuilder.setInsertionPointAfter(undefMarker.getDefiningOp());
}
}
More information about the flang-commits
mailing list