================
@@ -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) {
----------------
skatrak wrote:
This is mostly a copy of `captureImplicitMap` above except with some parts
stripped out. Rather than adding duplication, I think it's better to reuse the
same lambda and introduce changes as needed (and possibly split it into
multiple functions if it will help maintainability, as it has already grown
quite a bit).
https://github.com/llvm/llvm-project/pull/199967
_______________________________________________
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits