public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "aldyh at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/103088] [12 regression] 500.perlbench from spec 2017 fails since r12-4698
Date: Fri, 19 Nov 2021 10:09:26 +0000	[thread overview]
Message-ID: <bug-103088-4-eP4TZl7kiv@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-103088-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103088

--- Comment #13 from Aldy Hernandez <aldyh at gcc dot gnu.org> ---
(In reply to Tamar Christina from comment #11)

> Historically it has always only been for the test dataset with the problem
> Aldy encountered before with the signed zeros. See
> https://www.spec.org/cpu2017/Docs/benchmarks/500.perlbench_r.html at the
> section for GCC and -Ofast.
> 
> train and ref used to work fine before. It may be perfectly valid that we
> need it now for the rest too, but it's unclear to me if that's due to a new
> valid transformation or an invalid one.

Let's assume -ffast-math is supposed to work with ref for the time being, or
until I run out of cycles :).

I've reduced the failure to 2 jump threads, but unfortunately they're both
correct, so we can only conclude the threader is correct.  There could still be
a latent bug downstream.

Here are some notes on reproducing.

Ref takes 15 minutes to complete, but the problematic output can be seen within
the first minute.  The NaN output is from the diffmail.pl execution diffmail.pl
4 800 10 17 19 300.

The problem is Perl_pp_ge() in pp.c may be miscompiled.

On r12-5346, it can be reduced to:

$ rm pp.o
$ specmake OPTIMIZE="-O3 -ffast-math -fdisable-tree-threadfull2
-fdisable-tree-ethread -fdisable-tree-thread1 -fdisable-tree-thread2
-fno-tree-dominator-opts -fdbg-cnt=registered_jump_thread:173-173:175-175"

That is, turn off all jump threaders except threadfull1.

If we look for dbgcnt in pp.c.111t.threadfull1, we can see:

***dbgcnt: lower limit 173 reached for registered_jump_thread.***
***dbgcnt: upper limit 173 reached for registered_jump_thread.***
  [173] Registering jump thread: (36, 39) incoming edge;  (39, 40) normal (40,
42) nocopy; 
path: 36->39->40->42 SUCCESS

This corresponds to this path:

=========== BB 36 ============
    <bb 36> [local count: 584543650]:
    if (iftmp.546_109 < iftmp.547_110)
      goto <bb 39>; [34.00%]
    else
      goto <bb 37>; [66.00%]

=========== BB 39 ============
    <bb 39> [local count: 787582387]:
    # _111 = PHI <_69(20), -1(35), _77(23), _88(25), 1(36), _98(28), 2(37),
0(38), 1(26), -1(21)>
    _18 = _111 & 2;
    iftmp.533_35 = _18 == 0;

=========== BB 40 ============
    <bb 40> [local count: 953267993]:
    # iftmp.533_22 = PHI <iftmp.533_33(7), iftmp.533_35(39)>
    if (iftmp.533_22 != 0)
      goto <bb 42>; [50.00%]
    else
      goto <bb 41>; [50.00%]

We can clearly conclude iftmp.533_22 != 0 and thread through BB42.

The #175 thread is a virtually identical sequence.  Both are correct.

  parent reply	other threads:[~2021-11-19 10:09 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-04 20:45 [Bug other/103088] New: " seurer at gcc dot gnu.org
2021-11-05  7:25 ` [Bug tree-optimization/103088] " rguenth at gcc dot gnu.org
2021-11-05 11:26 ` marxin at gcc dot gnu.org
2021-11-05 13:35 ` rguenth at gcc dot gnu.org
2021-11-05 14:19 ` seurer at gcc dot gnu.org
2021-11-17 15:28 ` tnfchris at gcc dot gnu.org
2021-11-17 17:48 ` aldyh at gcc dot gnu.org
2021-11-17 17:53 ` tnfchris at gcc dot gnu.org
2021-11-17 18:58 ` seurer at gcc dot gnu.org
2021-11-18 16:35 ` aldyh at gcc dot gnu.org
2021-11-18 16:45 ` tnfchris at gcc dot gnu.org
2021-11-18 19:13 ` aldyh at gcc dot gnu.org
2021-11-19  7:06 ` rguenther at suse dot de
2021-11-19  8:10 ` tnfchris at gcc dot gnu.org
2021-11-19  8:14 ` rguenth at gcc dot gnu.org
2021-11-19 10:09 ` aldyh at gcc dot gnu.org [this message]
2021-11-19 11:40 ` marxin at gcc dot gnu.org
2021-11-19 11:47 ` aldyh at gcc dot gnu.org
2021-11-19 11:58 ` tnfchris at gcc dot gnu.org
2021-11-19 12:27 ` marxin at gcc dot gnu.org
2021-11-19 12:33 ` tnfchris at gcc dot gnu.org
2021-11-19 16:11 ` aldyh at gcc dot gnu.org
2021-11-19 16:14 ` aldyh at gcc dot gnu.org
2021-11-21 19:37 ` aldyh at gcc dot gnu.org
2021-11-22  7:37 ` rguenther at suse dot de
2021-11-23  7:38 ` tnfchris at gcc dot gnu.org
2021-11-29 16:35 ` segher at gcc dot gnu.org
2024-05-02 21:31 ` pinskia at gcc dot gnu.org

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=bug-103088-4-eP4TZl7kiv@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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).