public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "olegendo at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug rtl-optimization/55190] [SH] ivopts causes loop setup bloat
Date: Thu, 03 Oct 2013 10:00:00 -0000	[thread overview]
Message-ID: <bug-55190-4-lxh3mh03lx@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-55190-4@http.gcc.gnu.org/bugzilla/>

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55190

--- Comment #4 from Oleg Endo <olegendo at gcc dot gnu.org> ---
(In reply to bin.cheng from comment #3)
> ARM can benefit from doloop structure too, but it is implemented in
> different way. ARM backend defines special addsi_compare pattern and let
> combine pass combine decrement and comparison instruction, thus saving the
> comparison instruction.
> 
> IVOPT can be improved to select two iv candidates for the example loop, with
> auto-increment one for the memory access and decrement one for loop exit
> check.  This is especially good for target supports both doloop and
> auto-increment instructions like ARM and SH.

Yes, probably addressing mode selection for memories inside the loop can be
covered somehow by ivopt.  However, this PR is about the calculations of the
loop counter and the handling of overflows.

> 
> BUT most hand-written loops have incremental basic iv, so IVOPT depends on
> previous pass ivcanon to rewrite it into decremental iv, like below:
> 
> for (i = 0; i < 100; i++)
>   //loop body
> 
> ---->
> for (i = 100; i > 0; i--)
>   //modified loop body
> 
> Unfortunately, ivcanon pass only do such loop transformation for loop which
> iterates constant number times.
> 
> It seems difficult for RTL loop passes to revert decision made by IVOPT, so
> I think it should be done in GIMPLE IVOPT. I will give it a try.

I think this is a another story of missed ivopt opportunities.  Maybe open a
new PR for this?


  parent reply	other threads:[~2013-10-03 10:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-03 12:16 [Bug target/55190] New: " olegendo at gcc dot gnu.org
2013-02-16 11:13 ` [Bug target/55190] " olegendo at gcc dot gnu.org
2013-06-17  0:13 ` [Bug rtl-optimization/55190] " olegendo at gcc dot gnu.org
2013-09-30  7:16 ` amker.cheng at gmail dot com
2013-10-03 10:00 ` olegendo at gcc dot gnu.org [this message]
2014-07-31 18:03 ` olegendo at gcc dot gnu.org
2015-04-04 11:46 ` olegendo at gcc dot gnu.org
2015-04-07  7:27 ` [Bug rtl-optimization/55190] " olegendo at gcc dot gnu.org
2021-05-04 12:31 ` rguenth at gcc dot gnu.org
2023-07-07  6:49 ` olegendo 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-55190-4-lxh3mh03lx@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).