public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Uros Bizjak <ubizjak@gmail.com>
To: Segher Boessenkool <segher@kernel.crashing.org>
Cc: Richard Biener <rguenther@suse.de>,
	"gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>,
	 Jeff Law <jeffreyalaw@gmail.com>
Subject: Re: [PATCH v2] combine: Fix ICE in try_combine on pr112494.c [PR112560]
Date: Mon, 18 Mar 2024 16:44:30 +0100	[thread overview]
Message-ID: <CAFULd4ZUZOQznwkobNCLz5u+ozDXwT4jCgPLHv07Msxa2A-K0A@mail.gmail.com> (raw)
In-Reply-To: <20240318144909.GZ19790@gate.crashing.org>

On Mon, Mar 18, 2024 at 3:51 PM Segher Boessenkool
<segher@kernel.crashing.org> wrote:
>
> On Thu, Mar 07, 2024 at 11:46:54PM +0100, Uros Bizjak wrote:
> > > Can't you just describe the dataflow then, without an unspec?  An unspec
> > > by definition does some (unspecified) operation on the data.
> >
> > Previously, it was defined as:
> >
> >  (define_insn "*pushfl<mode>2"
> >    [(set (match_operand:W 0 "push_operand" "=<")
> >  (match_operand:W 1 "flags_reg_operand"))]
> >
> > But Wmode, AKA SI/DImode is not CCmode. And as said in my last
> > message, nothing prevents current source code to try to update the CC
> > register here.
>
> So you can use an unspec just to convert the flags reg to an integer?
> To make an integer representation of flags reg contents.

Yes, this is correct. But please note the v3 patch, where the mode
update is made at the correct location. Quote from the patch:

Replace cc_use_loc with the entire new RTX only in case cc_use_loc satisfies
COMPARISON_P predicate.  Otherwise scan the entire cc_use_loc RTX for CC reg
to be updated with a new mode.

> Or is that what we started with here?

The reason for the patch is that when CC reg is used outside
comparison RTX, the combine tries to update CC reg mode where it is
used after the combined instruction. This happens on extremely rare
occasions, but when it happens, combine assumes that it is used
exclusively in the comparison RTX and uses "SUBST (XEXP (*cc_use_loc,
0), ...);". XEXP (*cc_use_loc, 0) will segfault when CC reg is
referred in a simple SET assignment, not only when it is referred in
an UNSPEC. Please note that the comparison RTX is handled a few lines
above, where my patch also fixes the "???" issue.

Uros.

  reply	other threads:[~2024-03-18 15:44 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-07  9:16 Uros Bizjak
2024-03-07  9:55 ` Richard Biener
2024-03-07 10:11   ` Uros Bizjak
2024-03-07 10:22     ` Richard Biener
2024-03-07 17:44       ` Segher Boessenkool
2024-03-07 10:37     ` Jakub Jelinek
2024-03-07 10:45       ` Richard Biener
2024-03-07 11:22         ` Uros Bizjak
2024-03-07 17:51           ` Segher Boessenkool
2024-03-07 17:49         ` Segher Boessenkool
2024-03-07 10:57       ` Uros Bizjak
2024-03-07 17:36   ` Segher Boessenkool
2024-03-07 21:04     ` Uros Bizjak
2024-03-07 21:08       ` Uros Bizjak
2024-03-07 21:35       ` Segher Boessenkool
2024-03-07 22:07         ` Uros Bizjak
2024-03-07 22:27           ` Segher Boessenkool
2024-03-07 22:46             ` Uros Bizjak
2024-03-18 14:49               ` Segher Boessenkool
2024-03-18 15:44                 ` Uros Bizjak [this message]
2024-03-07 22:27           ` Uros Bizjak
2024-03-18 14:44             ` Segher Boessenkool
2024-03-18 15:29               ` Uros Bizjak

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=CAFULd4ZUZOQznwkobNCLz5u+ozDXwT4jCgPLHv07Msxa2A-K0A@mail.gmail.com \
    --to=ubizjak@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jeffreyalaw@gmail.com \
    --cc=rguenther@suse.de \
    --cc=segher@kernel.crashing.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).