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/64081] [5 Regression] r217827 prevents RTL loop unroll
Date: Wed, 26 Nov 2014 10:44:00 -0000	[thread overview]
Message-ID: <bug-64081-4-nfgM9UzbWr@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-64081-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
Well, the change allows DOM to CSE pos = 0 in

  <bb 2>:
  pos = 0;
  dir = 1;
  _45 = (long unsigned int) argc_9(D);
  if (_45 != 0)
    goto <bb 3>;
  else
    goto <bb 21>;

  <bb 3>:
  pretmp_75 = data;
  pretmp_77 = token;
  arr1.5_23 = arr1;
  arr2.7_27 = arr2;
  pos_lsm.17_22 = pos;

which in turn allows jump threading to do its work.

  Registering jump thread: (11, 12) incoming edge;  (12, 5) joiner;  (5, 23)
normal; (23, 21) nocopy;
...
  Threaded jump 11 --> 12 to 25

this changes the loop to have two latches (thus it becomes a loop nest), and
it adds one exit (now the loop has three).  Further down the road the extra
loop is no longer there but the three exits remain.

I don't see what is wrong with what DOM does here.

We do miss some interesting kind of optimization opportunities like
transforming

  if (prephitmp_87 == 1)
    goto <bb 9>;
  else
    goto <bb 10>;

  <bb 9>:
  _24 = arr1.5_23 + _62;
  pos.6_25 = *_24;
  goto <bb 11>;

  <bb 10>:
  _28 = arr2.7_27 + _62;
  pos.8_29 = *_28;

  <bb 11>:
  # prephitmp_89 = PHI <pos.6_25(9), pos.8_29(10)>

to

  if (prephitmp_87 == 1)
    goto <bb 9>;
  else
    goto <bb 11>;

  <bb 9>:
  goto <bb 11>;

  <bb 11>:
  # _24 = PHI <arr1.5_23, arr2.7_27>
  _28 = _24 + _62;
  prephitmp_89 = *_28;

sinking common computations through a PHI.

With the followup optimization in out-of-SSA to coalesce arr1.5_23 and
arr2.7_27 which means we can drop the conditional entirely.

Heh.  Fun idea.

Anyway - for this PR it is RTL unroll IV analysis that needs to be improved.


  parent reply	other threads:[~2014-11-26 10:44 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-26  8:56 [Bug tree-optimization/64081] New: " izamyatin at gmail dot com
2014-11-26 10:09 ` [Bug tree-optimization/64081] " rguenth at gcc dot gnu.org
2014-11-26 10:44 ` rguenth at gcc dot gnu.org [this message]
2014-11-26 10:44 ` rguenth at gcc dot gnu.org
2015-01-19 13:59 ` [Bug rtl-optimization/64081] " ienkovich at gcc dot gnu.org
2015-01-20  8:29 ` ienkovich at gcc dot gnu.org
2015-01-20  9:33 ` rguenth at gcc dot gnu.org
2015-01-20 22:01 ` law at redhat dot com
2015-01-20 22:02 ` pinskia at gcc dot gnu.org
2015-01-21  0:55 ` dje at gcc dot gnu.org
2015-01-21 20:01 ` izamyatin at gmail dot com
2015-01-21 20:02 ` izamyatin at gmail dot com
2015-01-22  2:33 ` dje at gcc dot gnu.org
2015-01-22 21:26 ` izamyatin at gmail dot com
2015-01-23  2:50 ` dje at gcc dot gnu.org
2015-01-26 18:51 ` izamyatin at gmail dot com
2015-02-20 10:53 ` jakub at gcc dot gnu.org
2015-02-20 11:53 ` izamyatin at gmail dot com
2015-03-24 18:21 ` steven at gcc dot gnu.org
2015-04-22 12:02 ` [Bug rtl-optimization/64081] [5/6 " jakub at gcc dot gnu.org
2015-07-16  9:17 ` rguenth at gcc dot gnu.org
2021-04-27 11:37 ` [Bug rtl-optimization/64081] [8/9/10/11/12 Regression] r217828 " jakub at gcc dot gnu.org
2021-07-28  7:04 ` [Bug rtl-optimization/64081] [9/10/11/12 " rguenth at gcc dot gnu.org
2022-04-21  7:47 ` rguenth at gcc dot gnu.org
2023-03-15 23:54 ` [Bug rtl-optimization/64081] [10/11/12/13 " pinskia at gcc dot gnu.org
2023-05-29 10:01 ` [Bug rtl-optimization/64081] [10/11/12/13/14 " jakub at gcc dot gnu.org
2024-03-13  3:36 ` [Bug rtl-optimization/64081] [11/12 " law 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-64081-4-nfgM9UzbWr@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).