[llvm-branch-commits] [flang] [mlir] [flang][OpenMP] Lower target in_reduction for host fallback (PR #199967)
Sairudra More via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Mon Jun 8 09:30:42 PDT 2026
================
@@ -3108,6 +3113,58 @@ genTargetOp(lower::AbstractConverter &converter, lower::SymMap &symTable,
Object{const_cast<semantics::Symbol *>(&sym), std::nullopt});
}
};
+ // OpenMP requires `in_reduction` list items on `target` to be implicitly
+ // data-mapped. The MLIR -> LLVM IR translation passes the mapped pointer
+ // as the `orig` argument of `__kmpc_task_reduction_get_th_data`, so the
+ // map must be address-preserving regardless of the scalar default capture
+ // (which would otherwise be ByCopy for small scalars and break the
+ // runtime lookup against the enclosing taskgroup's task_reduction
+ // descriptor). Emit these maps before the generic implicit-map walk so
+ // that walk treats the symbols as already mapped via
+ // `isDuplicateMappedSymbol` and does not downgrade them to ByCopy.
+ auto captureInReductionImplicitMap = [&](const semantics::Symbol &sym) {
----------------
Saieiei wrote:
Refactored it to reuse `captureImplicitMap(..., forceAddressPreserving)`
https://github.com/llvm/llvm-project/pull/199967
More information about the llvm-branch-commits
mailing list