On Tue, May 24, 2022 at 04:48:13PM +0200, Jakub Jelinek wrote: > > This version of the patch improves detection of explicitly-mapped struct > > accesses which inhibit implicitly-triggered user-defined mappers for a > > target region. > > Will start with a general comment, from looking at the dumps it seems > handling the mappers in the FE right away for explicit mapping clauses > and attaching mapper binding clauses for types that are (or could > conservatively be, including from the recursive mappers themselves) be > used in the target body and letting gimplification find those var in detail > and use mapper binding clauses to actually expand it looks like the right > approach to me. As I raised in an earlier patch, a big question is if we > should do map clause sorting on gimplify_scan_omp_clauses or > gimplify_adjust_omp_clauses or both... > The conservative discovery of what types we might need to create mapper > binding clauses for should be probably done only if > !processing_template_decl.
Oh, and one very important thing I forgot to say yesterday. With declare mapper but even the general mapping of aggregate is mapping of all its members/elements individually, we are going to end up with huge mapping lists. We need to undo that at compile time whenever possible, so if we after the declare mapper handling (from explicit or implicit mappings) and sorting the mapping clauses see that we have say struct S { int x, y, z[2], w; } s; and we see map (tofrom: s.x, s.y, s.z[0], s.z[1], s.w) we should turn that back into map (tofrom: s). Basically optimize consecutive mappings of the same kind to one that covers them together. Then there is the question of padding bits, if there is reasonably small padding in between mapped fields we could be mapping the padding too. Jakub