[flang-commits] [flang] [Flang][OpenMP] Minimize host ops remaining in device compilation (PR #137200)
Pranav Bhandarkar via flang-commits
flang-commits at lists.llvm.org
Tue Aug 26 21:58:05 PDT 2025
================
@@ -28,6 +31,41 @@ namespace flangomp {
using namespace mlir;
+/// Add an operation to the output set to be later rewritten.
+template <typename OpTy>
+static void collectRewrite(OpTy op, llvm::SetVector<OpTy> &rewrites) {
+ rewrites.insert(op);
+}
+
+/// Add an \c omp.map.info operation and all its members recursively to the
+/// output set to be later rewritten.
+///
+/// Dependencies across \c omp.map.info are maintained by ensuring dependencies
+/// are added to the output sets before operations based on them.
+template <>
+void collectRewrite(omp::MapInfoOp mapOp,
+ llvm::SetVector<omp::MapInfoOp> &rewrites) {
+ for (Value member : mapOp.getMembers())
----------------
bhandarkar-pranav wrote:
Should you also be collecting `mapOp.getVarPtrPtr().getDefiningOp()`?
https://github.com/llvm/llvm-project/pull/137200
More information about the flang-commits
mailing list