public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/109543] Avoid using BLKmode for unions with a non-BLKmode member when possible
Date: Wed, 19 Jul 2023 13:26:40 +0000	[thread overview]
Message-ID: <bug-109543-4-c2FYDAlzDE@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-109543-4@http.gcc.gnu.org/bugzilla/>

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.

  parent reply	other threads:[~2023-07-19 13:26 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-18 10:57 [Bug tree-optimization/109543] New: " avieira at gcc dot gnu.org
2023-04-18 11:25 ` [Bug tree-optimization/109543] " rguenth at gcc dot gnu.org
2023-04-24 10:10 ` avieira at gcc dot gnu.org
2023-04-24 10:12 ` avieira at gcc dot gnu.org
2023-07-19 13:26 ` rguenth at gcc dot gnu.org [this message]
2023-12-14 18:25 ` rsandifo at gcc dot gnu.org
2023-12-14 18:28 ` richard.sandiford at arm dot com
2023-12-15  7:35 ` rguenth at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-109543-4-c2FYDAlzDE@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).