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/84646] Missed optimisation for hoisting conditions outside nested loops
Date: Wed, 09 Nov 2022 08:17:07 +0000	[thread overview]
Message-ID: <bug-84646-4-OACgWoUm7s@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-84646-4@http.gcc.gnu.org/bugzilla/>

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |aldyh at gcc dot gnu.org

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Jeffrey A. Law from comment #2)
> The backwards threader discovers the threads, but refuses to optimize them
> because it thinks doing so will create an irreducible loop without enough
> benefit.

The reason is now:

Checking profitability of path (backwards):  bb:3 (2 insns) bb:7 (4 insns) bb:6
(1 insns) (latch) bb:5
  Control statement insns: 2
  Overall: 5 insns

 Registering value_relation (path_oracle) (j_17 < m_23(D)) (root: bb5)
path: 5->6->7->3->xx REJECTED (unreachable)

it seems the path oracle is confused here.


  <bb 3> [local count: 955630225]:
  if (running_14 != 0)
    goto <bb 4>; [50.00%]
  else
    goto <bb 6>; [50.00%]

  <bb 4> [local count: 477815112]:
  _1 = (long unsigned int) i_16;
  _2 = _1 * 4;
  _3 = p_25(D) + _2;
  _4 = *_3;
  _5 = (long unsigned int) j_17;
  _6 = _5 * 4;
  _7 = q_26(D) + _6;
  _8 = *_7;
  _9 = _4 * _8;
  sum_27 = _9 + sum_11;
  if (sum_27 > 19999)
    goto <bb 5>; [50.00%]
  else
    goto <bb 6>; [50.00%]

  <bb 5> [local count: 238907556]:

  <bb 6> [local count: 955630225]:
  # sum_10 = PHI <sum_11(3), 20000(5), sum_27(4)>
  # running_13 = PHI <0(3), 0(5), 1(4)>
  j_28 = j_17 + 1;

  <bb 7> [local count: 1073741824]:
  # sum_11 = PHI <sum_12(11), sum_10(6)>
  # running_14 = PHI <running_15(11), running_13(6)>
  # j_17 = PHI <0(11), j_28(6)>
  if (j_17 < m_23(D))
    goto <bb 3>; [89.00%]
  else
    goto <bb 8>; [11.00%]

       reply	other threads:[~2022-11-09  8:17 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-84646-4@http.gcc.gnu.org/bugzilla/>
2022-11-09  8:17 ` rguenth at gcc dot gnu.org [this message]
2022-11-09  8:39 ` rguenth at gcc dot gnu.org
2022-11-09  9:01 ` aldyh at gcc dot gnu.org
2022-11-09 12:54 ` rguenth at gcc dot gnu.org
2022-11-10 11:22 ` rguenth at gcc dot gnu.org
2022-11-10 13:13 ` cvs-commit at gcc dot gnu.org
2022-11-10 13:37 ` rguenth at gcc dot gnu.org
2022-11-10 14:19 ` cvs-commit at gcc dot gnu.org
2022-11-10 15:13 ` rguenth at gcc dot gnu.org
2022-11-11 13:32 ` 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-84646-4-OACgWoUm7s@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).