On Mon, Mar 22, 2021 at 4:10 AM Richard Biener
<richard.guent...@gmail.com> wrote:

> Oh, and for a type like
>
>  struct { struct { struct { ... { double x; } } } } } };
>
> the layout now looks quadratic in work (each field layout will look at
> the nest rooted at it
> up to the bottom).  It looks to me as we require(?) the field types to
> be laid out and thus
> at least an early out checking the type alignment to be >= 64 can work?

rs6000_special_round_type_align and rs6000_special_adjust_field_align
both can have early exits to handle some easy cases.  Thanks for
pointing that out.

struct A { struct { struct { ... { double x; } } } };
struct B { struct A; struct A; struct A; struct A; ...; };

is a particularly ugly situation.

When I originally had implemented this in GCC, the recursive nature of
the requirement was not clear. Changing the alignment for a type
(struct) in two different contexts (bare versus member) is bizarre,
but that is what IBM XL compilers implement.

If this becomes a time-sink for for in real use cases, one could
create a side cache of the type with the previously calculated
alignment value.  Or are there some preferred, available flag bit in
the tree that can record that the type alignment has been checked and
either use TYPE_ALIGN or use 32?  Maybe protected_flag or
side_effects_flag or nothrow_flag?

Thanks, David

Reply via email to