public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Segher Boessenkool <segher@kernel.crashing.org>
To: Jeff Law <jeffreyalaw@gmail.com>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] Always enable LRA
Date: Fri, 14 Oct 2022 11:37:00 -0500	[thread overview]
Message-ID: <20221014163700.GE25951@gate.crashing.org> (raw)
In-Reply-To: <d7030fd2-6d1f-9a81-fc3d-b4e3e9efb094@gmail.com>

Hi!

On Thu, Oct 13, 2022 at 10:47:20PM -0600, Jeff Law wrote:
> On 10/13/22 17:56, Segher Boessenkool wrote:
> >h8300 fails during GCC build:
> >/home/segher/src/gcc/libgcc/unwind.inc: In function 
> >'_Unwind_SjLj_RaiseException':
> >/home/segher/src/gcc/libgcc/unwind.inc:141:1: error: could not split insn
> >   141 | }
> >       | ^
> >(insn 69 256 327 (set (mem/f:SI (pre_dec:SI (reg/f:SI 7 sp)) [12  S4 A32])
> >         (reg/f:SI 7 sp)) "/home/segher/src/gcc/libgcc/unwind.inc":118:12 
> >         19 {*movsi}
> >      (expr_list:REG_ARGS_SIZE (const_int 4 [0x4])
> >         (nil)))
> >during RTL pass: final
> >which looks like a backend bug, I don't see a pattern that could split
> >this (without needing an extra clobber)?
> 
> Really smells like an LRA bug to me.
> 
> 
> We have this as we leave IRA:
> 
> 
> (insn 10 9 11 2 (set (reg/f:SI 30)
>        (plus:SI (reg/f:SI 11 fp)
>            (const_int -4 [0xfffffffffffffffc]))) "j.c":31:7 264 
> {*addsi}
>     (expr_list:REG_EQUIV (plus:SI (reg/f:SI 11 fp)
>            (const_int -4 [0xfffffffffffffffc]))
> (nil)))
> (insn 11 10 12 2 (set (mem/f:SI (pre_dec:SI (reg/f:SI 7 sp)) [3  S4 A32])
>        (reg/f:SI 30)) "j.c":31:7 19 {*movsi}
>     (expr_list:REG_DEAD (reg/f:SI 30)
>        (expr_list:REG_ARGS_SIZE (const_int 4 [0x4])
>            (nil))))
> 
> 
> And as we leave LRA:
> 
> (note 10 9 11 2 NOTE_INSN_DELETED)
> (insn 11 10 13 2 (set (mem/f:SI (pre_dec:SI (reg/f:SI 7 sp)) [3 S4 A32])
>         (reg/f:SI 7 sp)) "j.c":31:7 19 {*movsi}
>      (expr_list:REG_ARGS_SIZE (const_int 4 [0x4])
>         (nil)))

LRA only ever generates insns that pass recog.  The backend allows this
define_insn, requiring it to be split (it returns template "#"), but
then somehow it doesn't match in any split pass?

> Register elimination ultimately discovered that (reg 30) was the same as 
> the stack pointer and did the natural substitution.    The natural 
> substitution results in invalid RTL and there's really no way to back 
> out and do something different AFAICT in lra-eliminations.cc.
> 
> The only reason we fault is because the H8 backend knows this is invalid 
> RTL and refuses to split it.  If we were to try and re-recognize the 
> insn in question it would fail to recognize after the substitution 
> because the auto-inc'd operand overlaps with the other operand.

But it *did* recog?  Or does LRA somehow not always recog() everything?
I always thought that was one of the huge improvements over old reload
(it does everything very locally instead of very globally)!


Segher

  reply	other threads:[~2022-10-14 16:38 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-13 23:56 Segher Boessenkool
2022-10-14  0:36 ` Koning, Paul
2022-10-14 16:18   ` Segher Boessenkool
2022-10-14 16:48     ` Koning, Paul
2022-10-14  1:07 ` Jeff Law
2022-10-14 12:37   ` Koning, Paul
2022-10-14 14:38     ` Jeff Law
2022-10-14 16:37       ` Koning, Paul
2022-10-14 17:10         ` Jeff Law
2022-10-14 17:36           ` Koning, Paul
2022-10-14 21:15             ` Jeff Law
2022-10-14 21:21               ` Koning, Paul
2022-10-14 21:30                 ` Jeff Law
2022-10-15  0:19                 ` Jeff Law
2022-10-14 16:39       ` Richard Biener
2022-10-14 17:11         ` Jeff Law
2022-10-14  4:47 ` Jeff Law
2022-10-14 16:37   ` Segher Boessenkool [this message]
2022-10-14 17:07     ` Jeff Law
2022-10-14 17:35       ` Segher Boessenkool
2022-10-14 18:03         ` Jeff Law
2022-10-14 19:58           ` Koning, Paul
2022-10-14 20:12             ` Segher Boessenkool
2022-10-14 20:40               ` Koning, Paul
2022-10-14  6:20 ` Takayuki 'January June' Suwa
2022-10-14 16:25   ` Segher Boessenkool
2022-10-15  3:18     ` Takayuki 'January June' Suwa

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=20221014163700.GE25951@gate.crashing.org \
    --to=segher@kernel.crashing.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jeffreyalaw@gmail.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).