public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/108166] [12/13 Regression] Wrong code with -O2 since r12-8078-ga42aa68bf1ad745a
Date: Wed, 21 Dec 2022 13:12:57 +0000	[thread overview]
Message-ID: <bug-108166-4-F6KsRd9jWs@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-108166-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
But we end up with

 <bb 2> [local count: 1073741824]:
  b.1_1 = b;
  if (b.1_1 != 0)
    goto <bb 3>; [50.00%]
  else
    goto <bb 4>; [50.00%]

  <bb 3> [local count: 536870913]:
  iftmp.3_14 = d;

  <bb 4> [local count: 966367640]:
  # RANGE [irange] int [-INF, -1][1, +INF]
  # iftmp.3_10 = PHI <iftmp.3_14(3), 0(2)>

  <bb 6> [local count: 1073741824]:
  # RANGE [irange] int [-INF, -1][1, +INF]
  # iftmp.2_9 = PHI <iftmp.3_10(4)>
  _4 = iftmp.2_9 < 0;

before CFG cleanup which does look wrong.  Before the phiopt we have

  <bb 4> [local count: 966367640]:
  # iftmp.3_10 = PHI <iftmp.3_14(3), 0(2)>
  if (iftmp.3_10 != 0)
    goto <bb 6>; [56.25%]
  else 
    goto <bb 5>; [43.75%]

  <bb 5> [local count: 536870913]:

  <bb 6> [local count: 1073741824]:
  # RANGE [irange] int [-INF, -1][1, +INF]
  # iftmp.2_9 = PHI <iftmp.3_10(4), 8(5)>
  _4 = iftmp.2_9 < 0;

but clearly value-replacing the edge 5->6 with iftmp.3_10 is wrong (its
zero, not 8 on that edge)?

  parent reply	other threads:[~2022-12-21 13:12 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-18 19:46 [Bug tree-optimization/108166] New: [12/13 Regression] Wrong code with -O2 vsevolod.livinskiy at gmail dot com
2022-12-18 21:08 ` [Bug tree-optimization/108166] " pinskia at gcc dot gnu.org
2022-12-19  8:17 ` rguenth at gcc dot gnu.org
2022-12-19  8:34 ` [Bug tree-optimization/108166] [12/13 Regression] Wrong code with -O2 since r12-8078-ga42aa68bf1ad745a marxin at gcc dot gnu.org
2022-12-19 13:13 ` jakub at gcc dot gnu.org
2022-12-21 12:52 ` jakub at gcc dot gnu.org
2022-12-21 13:12 ` rguenth at gcc dot gnu.org [this message]
2022-12-21 13:14 ` rguenth at gcc dot gnu.org
2022-12-21 13:35 ` jakub at gcc dot gnu.org
2022-12-22 11:53 ` cvs-commit at gcc dot gnu.org
2022-12-22 11:55 ` [Bug tree-optimization/108166] [12 " jakub at gcc dot gnu.org
2023-02-10 17:45 ` cvs-commit at gcc dot gnu.org
2023-02-10 17:59 ` jakub at gcc dot gnu.org
2024-02-01 22:16 ` 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-108166-4-F6KsRd9jWs@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).