public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Manolis Tsamis <manolis.tsamis@vrull.eu>
To: Jeff Law <jeffreyalaw@gmail.com>
Cc: gcc-patches@gcc.gnu.org, "Richard Biener" <rguenther@suse.de>,
	"Philipp Tomsich" <philipp.tomsich@vrull.eu>,
	"Christoph Müllner" <christoph.muellner@vrull.eu>,
	"Jiangning Liu" <jiangning.liu@amperecomputing.com>,
	"Jakub Jelinek" <jakub@redhat.com>,
	"Andrew Pinski" <quic_apinski@quicinc.com>
Subject: Re: [PATCH v2] Target-independent store forwarding avoidance.
Date: Thu, 13 Jun 2024 14:40:52 +0300	[thread overview]
Message-ID: <CAM3yNXqWJzkv1uJyjfD5GHrUyqKNM1tBjiNjLst_Syagpns1UA@mail.gmail.com> (raw)
In-Reply-To: <829fcc36-f1b2-474b-a297-3a516741ece3@gmail.com>

On Sun, Jun 9, 2024 at 5:29 PM Jeff Law <jeffreyalaw@gmail.com> wrote:
>
>
>
> On 6/7/24 4:31 PM, Jeff Law wrote:
>
> >
> > I've actually added it to my tester just to see if there's any fallout.
> > It'll take a week to churn through the long running targets that
> > bootstrap in QEMU, but the crosses should have data Monday.
> The first round naturally didn't trigger anything because the option is
> off by default.  So I twiddled it to be on at -O1 and above.
>
> epiphany-elf ICEs in gen_rtx_SUBREG with the attached .i file compiled
> with -O2:
>
> > root@577c7458c93a://home/jlaw/jenkins/workspace/epiphany-elf/epiphany-elf-obj/newlib/epiphany-elf/newlib/libm/complex# epiphany-elf-gcc -O2 libm_a-cacos.i
> > during RTL pass: avoid_store_forwarding
> > ../../../..//newlib-cygwin/newlib/libm/complex/cacos.c: In function 'cacos':
> > ../../../..//newlib-cygwin/newlib/libm/complex/cacos.c:99:1: internal compiler error: in gen_rtx_SUBREG, at emit-rtl.cc:1032
> > 0x614538 gen_rtx_SUBREG(machine_mode, rtx_def*, poly_int<1u, unsigned long>)
> >         ../../..//gcc/gcc/emit-rtl.cc:1032
> > 0x614538 gen_rtx_SUBREG(machine_mode, rtx_def*, poly_int<1u, unsigned long>)
> >         ../../..//gcc/gcc/emit-rtl.cc:1030
> > 0xe82216 process_forwardings
> >         ../../..//gcc/gcc/avoid-store-forwarding.cc:273
> > 0xe82216 avoid_store_forwarding
> >         ../../..//gcc/gcc/avoid-store-forwarding.cc:489
> > 0xe82667 execute
> >         ../../..//gcc/gcc/avoid-store-forwarding.cc:558
>

Fixed in v3.
Since we're dealing with arbitrary modes we need to call
validate_subreg before doing gen_rtx_SUBREG. E.g. a SFMode to TIMode
subreg would fail there.
The code already handled not being able to use the subreg if recog
failed so only an additional check was needed. I have added a new
testcase function ssll_load_elim_2 that triggered this.

>
> ft32-elf ICE'd in bitmap_check_index at various optimization levels:
>
> > FAIL: execute/pr108498-2.c   -O1  (internal compiler error: in bitmap_check_index, at sbitmap.h:104)
> > FAIL: execute/pr108498-2.c   -O1  (test for excess errors)
> > FAIL: execute/pr108498-2.c   -O2  (internal compiler error: in bitmap_check_index, at sbitmap.h:104)
> > FAIL: execute/pr108498-2.c   -O2  (test for excess errors)
> > FAIL: execute/pr108498-2.c   -O3 -g  (internal compiler error: in bitmap_check_index, at sbitmap.h:104)
> > FAIL: execute/pr108498-2.c   -O3 -g  (test for excess errors)
>

Fixed in v3 as well.
The offending store had BLKMode and returned a store size of 0 which
could overflow it->offset + store_size - 1 among others. A new check
is added to reject any BLKMode set. I also added a check for sets that
have a memory source and destination as these wouldn't be handled
correctly.

>
> avr, c6x,
>
> lm32-elf failed to build libgcc with an ICE in leaf_function_p, I
> haven't isolated that yet.
>
>
> There were other failures as well.  But you've got a few to start with
> and we can retest pretty easily as the patch evolves.
>

The v3 also contains a fix for a memory corruption bug due to
stores.safe_push (stores[move_to_front]) having a self reference and
storing garbage when the push resulted in a resize. A testcase
function ssll_load_elim_3 that triggered this has been added.

Could you please run the v3 with your tester? I assume some of the
additional fixes introduced may clear some of the other issues.

Thanks,
Manolis

> jeff
>

  parent reply	other threads:[~2024-06-13 11:41 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-06 10:10 Manolis Tsamis
2024-06-07 22:31 ` Jeff Law
2024-06-09 14:29   ` Jeff Law
2024-06-10  8:03     ` Manolis Tsamis
2024-06-13 11:40     ` Manolis Tsamis [this message]
2024-06-13 13:59       ` Jeff Law
2024-06-10  6:26   ` Richard Biener
2024-06-10  7:55   ` Manolis Tsamis
2024-06-10 18:03     ` Jeff Law
2024-06-10 18:27       ` Philipp Tomsich
2024-06-10 18:37         ` Jeff Law
2024-06-12 13:02         ` Manolis Tsamis
2024-06-11  7:22       ` Richard Biener
2024-06-11 13:37         ` Jeff Law
2024-06-11 13:52           ` Philipp Tomsich
2024-06-11 14:18             ` Jeff Law
2024-06-12  6:47               ` Richard Biener
2024-06-12 14:18                 ` Jeff Law

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=CAM3yNXqWJzkv1uJyjfD5GHrUyqKNM1tBjiNjLst_Syagpns1UA@mail.gmail.com \
    --to=manolis.tsamis@vrull.eu \
    --cc=christoph.muellner@vrull.eu \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=jeffreyalaw@gmail.com \
    --cc=jiangning.liu@amperecomputing.com \
    --cc=philipp.tomsich@vrull.eu \
    --cc=quic_apinski@quicinc.com \
    --cc=rguenther@suse.de \
    /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).