public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/103061] [12 Regression] 527.cam4_r miscompiled with -O2 -march=znver1 since r12-4790-g4b3a325f07acebf4
Date: Sat, 06 Nov 2021 15:36:14 +0000	[thread overview]
Message-ID: <bug-103061-4-r7gbWUocEq@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-103061-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #17 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Aldy Hernandez <aldyh@gcc.gnu.org>:

https://gcc.gnu.org/g:4856699eeb2809c50930bafe341a96470877195d

commit r12-4971-g4856699eeb2809c50930bafe341a96470877195d
Author: Aldy Hernandez <aldyh@redhat.com>
Date:   Fri Nov 5 22:25:19 2021 +0100

    path oracle: Do not look at root oracle for killed defs.

    The problem here is that we are incorrectly threading 41->20->21 here:

      <bb 35> [local count: 56063504182]:
      _134 = M.10_120 + 1;
      if (_71 <= _134)
        goto <bb 19>; [11.00%]
      else
        goto <bb 41>; [89.00%]
    ...
    ...
    ...
      <bb 41> [local count: 49896518755]:

      <bb 20> [local count: 56063503181]:
      # lb_75 = PHI <_134(41), 1(18)>
      _117 = mstep_49 + lb_75;
      _118 = _117 + -1;
      _119 = mstep_49 + _118;
      M.10_120 = MIN_EXPR <_119, _71>;
      if (lb_75 > M.10_120)
        goto <bb 21>; [11.00%]
      else
        goto <bb 22>; [89.00%]

    First, lb_17 == _134 because of the PHI.
    Second, _134 > M.10_120 because of _134 = M.10_120 + 1.

    We then assume that lb_75 > M.10_120, but this is incorrect because
    M.10_120 was killed along the path.

    This incorrect thread causes the miscompilation in 527.cam4_r.

    Tested on x86-64 and ppc64le Linux.

    gcc/ChangeLog:

            PR tree-optimization/103061
            * value-relation.cc (path_oracle::path_oracle): Initialize
            m_killed_defs.
            (path_oracle::killing_def): Set m_killed_defs.
            (path_oracle::query_relation): Do not look at the root oracle for
            killed defs.
            * value-relation.h (class path_oracle): Add m_killed_defs.

  parent reply	other threads:[~2021-11-06 15:36 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-03 14:18 [Bug tree-optimization/103061] New: " marxin at gcc dot gnu.org
2021-11-03 14:18 ` [Bug tree-optimization/103061] " marxin at gcc dot gnu.org
2021-11-03 14:28 ` marxin at gcc dot gnu.org
2021-11-03 14:34 ` marxin at gcc dot gnu.org
2021-11-04 20:44 ` seurer at gcc dot gnu.org
2021-11-05 11:47 ` aldyh at gcc dot gnu.org
2021-11-05 11:51 ` aldyh at gcc dot gnu.org
2021-11-05 11:58 ` marxin at gcc dot gnu.org
2021-11-05 12:02 ` aldyh at gcc dot gnu.org
2021-11-05 12:07 ` pinskia at gcc dot gnu.org
2021-11-05 12:27 ` aldyh at gcc dot gnu.org
2021-11-05 12:35 ` marxin at gcc dot gnu.org
2021-11-05 12:45 ` marxin at gcc dot gnu.org
2021-11-05 13:16 ` amacleod at redhat dot com
2021-11-05 13:28 ` aldyh at gcc dot gnu.org
2021-11-05 14:44 ` aldyh at gcc dot gnu.org
2021-11-05 21:39 ` aldyh at gcc dot gnu.org
2021-11-06  8:26 ` marxin at gcc dot gnu.org
2021-11-06 15:36 ` cvs-commit at gcc dot gnu.org [this message]
2021-11-06 15:36 ` aldyh at gcc dot gnu.org
2021-12-10 12:04 ` cvs-commit 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-103061-4-r7gbWUocEq@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).