================
@@ -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
_______________________________________________
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits