public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Robin Dapp <rdapp@linux.ibm.com>
To: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: [PATCH] combine: Check for paradoxical subreg
Date: Wed, 23 Jun 2021 13:33:48 +0200	[thread overview]
Message-ID: <23c7868a-6736-5c73-fa9a-05e3e5ef53d6@linux.ibm.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 838 bytes --]

Hi,

while evaluating another patch that introduces more lvalue paradoxical 
subregs I ran into an ICE in combine at

  	  wide_int o = wi::insert (rtx_mode_t (outer, temp_mode),
				   rtx_mode_t (inner, dest_mode),
				   offset, width);

because width (=GET_MODE_PRECISION (dest_mode)) > GET_MODE_PRECISION 
(temp_mode).

 From the comments and the code it looks like we do not want to handle a 
paradoxical subreg here so I quickly added a check for it which prevents 
the ICE.  The check could also be added to reg_subword_p () I guess.

Is this the right thing to do or am I missing something, i.e. my other 
patch might be doing something it should not?

Bootstrap on s390x was successful and testsuite is looking good so far.

Regards
  Robin

--

gcc/ChangeLog:

         * combine.c (try_combine): Check for paradoxical subreg.

[-- Attachment #2: 0011-combine-paradoxical-subreg-fix.patch --]
[-- Type: text/x-patch, Size: 949 bytes --]

From 2b74c66f8d97c30c45e99336c9871cccd8cf94e1 Mon Sep 17 00:00:00 2001
From: Robin Dapp <rdapp@linux.ibm.com>
Date: Tue, 22 Jun 2021 17:35:37 +0200
Subject: [PATCH 11/11] combine paradoxical subreg fix.

---
 gcc/combine.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gcc/combine.c b/gcc/combine.c
index 6476812a212..de04560db21 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -2782,7 +2782,8 @@ try_combine (rtx_insn *i3, rtx_insn *i2, rtx_insn *i1, rtx_insn *i0,
       && CONST_SCALAR_INT_P (SET_SRC (temp_expr))
       && GET_CODE (PATTERN (i3)) == SET
       && CONST_SCALAR_INT_P (SET_SRC (PATTERN (i3)))
-      && reg_subword_p (SET_DEST (PATTERN (i3)), SET_DEST (temp_expr)))
+      && reg_subword_p (SET_DEST (PATTERN (i3)), SET_DEST (temp_expr))
+      && !paradoxical_subreg_p (SET_DEST (PATTERN (i3))))
     {
       rtx dest = SET_DEST (PATTERN (i3));
       rtx temp_dest = SET_DEST (temp_expr);
-- 
2.31.1


             reply	other threads:[~2021-06-23 11:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-23 11:33 Robin Dapp [this message]
2021-07-05 10:28 ` Robin Dapp
2021-09-24 10:17   ` Robin Dapp
2021-10-14  8:49 ` Richard Sandiford

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=23c7868a-6736-5c73-fa9a-05e3e5ef53d6@linux.ibm.com \
    --to=rdapp@linux.ibm.com \
    --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).