From: Richard Biener <rguenther@suse.de>
To: gcc-patches@gcc.gnu.org
Subject: [PATCH] middle-end/102450 - avoid type_for_size for non-existing modes
Date: Mon, 27 Sep 2021 15:04:16 +0200 (CEST) [thread overview]
Message-ID: <92p5834s-q121-8n1-6o5s-91q4192o249p@fhfr.qr> (raw)
This avoids asking type_for_size for types with sizes for which
no scalar integer mode exists. Instead the following uses
int_mode_for_size to get the same result.
Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed.
2021-09-27 Richard Biener <rguenther@suse.de>
PR middle-end/102450
* gimple-fold.c (gimple_fold_builtin_memory_op): Avoid using
type_for_size, instead use int_mode_for_size.
---
gcc/gimple-fold.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/gcc/gimple-fold.c b/gcc/gimple-fold.c
index 6fea8a6f9fd..474d0f44375 100644
--- a/gcc/gimple-fold.c
+++ b/gcc/gimple-fold.c
@@ -1001,9 +1001,7 @@ gimple_fold_builtin_memory_op (gimple_stmt_iterator *gsi,
return false;
scalar_int_mode mode;
- tree type = lang_hooks.types.type_for_size (ilen * 8, 1);
- if (type
- && is_a <scalar_int_mode> (TYPE_MODE (type), &mode)
+ if (int_mode_for_size (ilen * 8, 0).exists (&mode)
&& GET_MODE_SIZE (mode) * BITS_PER_UNIT == ilen * 8
&& have_insn_for (SET, mode)
/* If the destination pointer is not aligned we must be able
@@ -1013,6 +1011,7 @@ gimple_fold_builtin_memory_op (gimple_stmt_iterator *gsi,
|| (optab_handler (movmisalign_optab, mode)
!= CODE_FOR_nothing)))
{
+ tree type = build_nonstandard_integer_type (ilen * 8, 1);
tree srctype = type;
tree desttype = type;
if (src_align < GET_MODE_ALIGNMENT (mode))
--
2.31.1
reply other threads:[~2021-09-27 13:04 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=92p5834s-q121-8n1-6o5s-91q4192o249p@fhfr.qr \
--to=rguenther@suse.de \
--cc=gcc-patches@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).