[flang-commits] [flang] [flang][OpenMP] Reuse canonical default mapper names for nested mappings - fix issue #210402 (PR #212251)

via flang-commits flang-commits at lists.llvm.org
Wed Aug 12 03:35:56 PDT 2026


laoshd wrote:

> Could you also add a direct-PDT case like this? The current PDT coverage goes through holder types, so nested mapper generation passes a kind-aware canonical name. Direct mapping still starts from getDefaultMapperID(), which uses typeSpec->name() and can treat an existing kindless pdt mapper as reusable before getOrGenImplicitDefaultDeclareMapper() has a chance to validate the record type.
> 
> ```
> module direct_pdt_case
>   type :: direct_pdt(k)
>     integer, kind :: k
>     real(k), allocatable :: a(:)
>   end type
> contains
>   subroutine trigger
>     type(direct_pdt(4)) :: h4
>     type(direct_pdt(8)) :: h8
>     !$omp target data map(h4, h8)
>     !$omp end target data
>   end subroutine
> end module
> 
> ! CHECK-DAG: omp.declare_mapper @{{.*}}direct_pdtK4_omp_default_mapper : !fir.type<{{.*}}Tdirect_pdtK4
> ! CHECK-DAG: omp.declare_mapper @{{.*}}direct_pdtK8_omp_default_mapper : !fir.type<{{.*}}Tdirect_pdtK8
> ! CHECK-DAG: mapper(@{{.*}}direct_pdtK4_omp_default_mapper)
> ! CHECK-DAG: mapper(@{{.*}}direct_pdtK8_omp_default_mapper)
> ```

Good idea. It did catch a problem. Added the test case to the regression test. Fixed the problem.

https://github.com/llvm/llvm-project/pull/212251


More information about the flang-commits mailing list