From: Richard Biener <rguenther@suse.de>
To: Jakub Jelinek <jakub@redhat.com>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] lower-bitint: Force some arrays corresponding to large/huge _BitInt SSA_NAMEs to BLKmode
Date: Thu, 18 Jan 2024 08:27:51 +0100 (CET) [thread overview]
Message-ID: <10q608oq-n50o-r767-94o0-p5o561415osr@fhfr.qr> (raw)
In-Reply-To: <ZajSnzdsI007ABOH@tucnak>
On Thu, 18 Jan 2024, Jakub Jelinek wrote:
> Hi!
>
> On aarch64 the backend decides to use non-BLKmode for some arrays
> like unsigned long[4] - OImode in that case, but the corresponding
> BITINT_TYPEs have BLKmode (like structures containing that many limb
> elements). This both isn't a good idea (we really want such underlying vars
> to live in memory and access them there, rather than live in registers and
> access their parts in there) and causes ICEs during expansion
> (VIEW_CONVERT_EXPR from such OImode array to BLKmode BITINT_TYPE), so the
> following patch makes sure such arrays reflect the BLKmode of BITINT_TYPEs
> it is accessed with (if any).
>
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
So the issue is only manifesting during expansion? I think it would
be better to detect the specific issue (V_C_E from register to BLKmode)
in discover_nonconstant_array_refs_r and force the register argument
to stack?
> 2024-01-18 Jakub Jelinek <jakub@redhat.com>
>
> * gimple-lower-bitint.cc (gimple_lower_bitint): When creating
> array VAR_DECL for BITINT_TYPE SSA_NAMEs which have BLKmode, force
> DECL_MODE of those vars to be BLKmode as well.
>
> --- gcc/gimple-lower-bitint.cc.jj 2024-01-17 14:43:33.498961304 +0100
> +++ gcc/gimple-lower-bitint.cc 2024-01-17 14:50:50.252889131 +0100
> @@ -6348,7 +6348,15 @@ gimple_lower_bitint (void)
> tree s = ssa_name (i);
> int p = var_to_partition (large_huge.m_map, s);
> if (large_huge.m_vars[p] != NULL_TREE)
> - continue;
> + {
> + /* If BITINT_TYPE is BLKmode, make sure the underlying
> + variable is BLKmode as well. */
> + if (TYPE_MODE (TREE_TYPE (s)) == BLKmode
> + && VAR_P (large_huge.m_vars[p])
> + && DECL_MODE (large_huge.m_vars[p]) != BLKmode)
> + DECL_MODE (large_huge.m_vars[p]) = BLKmode;
> + continue;
> + }
> if (atype == NULL_TREE
> || !tree_int_cst_equal (TYPE_SIZE (atype),
> TYPE_SIZE (TREE_TYPE (s))))
> @@ -6359,6 +6367,11 @@ gimple_lower_bitint (void)
> }
> large_huge.m_vars[p] = create_tmp_var (atype, "bitint");
> mark_addressable (large_huge.m_vars[p]);
> + /* If BITINT_TYPE is BLKmode, make sure the underlying
> + variable is BLKmode as well. */
> + if (TYPE_MODE (TREE_TYPE (s)) == BLKmode
> + && DECL_MODE (large_huge.m_vars[p]) != BLKmode)
> + DECL_MODE (large_huge.m_vars[p]) = BLKmode;
> }
> }
>
>
> Jakub
>
>
--
Richard Biener <rguenther@suse.de>
SUSE Software Solutions Germany GmbH,
Frankenstrasse 146, 90461 Nuernberg, Germany;
GF: Ivo Totev, Andrew McDonald, Werner Knoblich; (HRB 36809, AG Nuernberg)
next prev parent reply other threads:[~2024-01-18 7:33 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-18 7:26 Jakub Jelinek
2024-01-18 7:27 ` Richard Biener [this message]
2024-01-18 11:01 ` Jakub Jelinek
2024-01-18 11:11 ` Jakub Jelinek
2024-01-18 12:16 ` Richard Biener
2024-01-18 12:32 ` Jakub Jelinek
2024-01-18 12:34 ` Richard Biener
2024-01-18 12:46 ` Jakub Jelinek
2024-01-18 12:57 ` Richard Biener
2024-01-18 13:13 ` Jakub Jelinek
2024-01-18 13:18 ` Jakub Jelinek
2024-01-18 13:36 ` Richard Biener
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=10q608oq-n50o-r767-94o0-p5o561415osr@fhfr.qr \
--to=rguenther@suse.de \
--cc=gcc-patches@gcc.gnu.org \
--cc=jakub@redhat.com \
/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).