https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109543

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
I think for SRA the issue is that there's no access to any of the unions
components and as Martin says it disqualifies total scalarization.

I think total scalarization would be possible if we can use the one and
only component type that's actually used (and that component is a register
type) or if there's no component explicitely used and we have a register
that's suitable to represent the whole bit representation of the union.

At materialization time the only thing we have to make sure is that we
not replace

 a[0] = X;

with

 a[0].component = X-component_register;

but retain the union typed copy like

 a[0] = V_C_E <union-type> (X-component_register);

(not sure if that's valid GIMPLE ...).  The important thing is to
preserve the TBAA behavior of both the original aggregate loads and
the store which means we have to keep the union type visible in the
access path, not only preserving the alias-set (at least I think so).

That said, a vector-float isn't a good bit representation.  There's
eventually type_for_mode () using the union mode if it's not BLKmode.
That might not be the worst choice.

Reply via email to