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/44794] pre- and post-loops should not be unrolled.
Date: Thu, 09 Mar 2023 08:06:50 +0000	[thread overview]
Message-ID: <bug-44794-4-JYdG2CH4C8@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-44794-4@http.gcc.gnu.org/bugzilla/>

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot gnu.org
   Last reconfirmed|                            |2023-03-09
             Status|UNCONFIRMED                 |ASSIGNED
     Ever confirmed|0                           |1

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
On trunk we end up with a vectorized loop with unrolled vectorized epilogue and
scalar iteration and with a scalar loop copy used for n == 1 and the case
when 'a' and 'b' alias, so this loop covers all possible 'n'.  Prefetching then
(rightfully) prefetches both of these which makes four out of them.

What can be improved is the upper bound on the iteration for the epilog loop as
created by tree_unroll_loop.  That results in the RTL unroller seeing

-  upper bound: 2147483646
-  likely upper bound: 2147483646
+  upper bound: 14
+  likely upper bound: 14
   realistic bound: -1
 ;; Unable to prove that the loop iterates constant times
+;; Not unrolling loop, doesn't roll

...

-  upper bound: 536870910
-  likely upper bound: 536870910
+  upper bound: 2
+  likely upper bound: 2
   realistic bound: -1
 ;; Unable to prove that the loop iterates constant times
+;; Not unrolling loop, doesn't roll

and thus only unrolling the main loops again.  The prefetching unrolling
should have been enough of course - I suppose the RTL unroller could detect
prefetch instructions and refrain from unrolling loops with prefetches
on the basis they are already tuned well (that could be also implemented
in the unroll control target hook).

I am testing a patch to improve the situation.

       reply	other threads:[~2023-03-09  8:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-44794-4@http.gcc.gnu.org/bugzilla/>
2023-03-09  8:06 ` rguenth at gcc dot gnu.org [this message]
2023-04-19 11:51 ` cvs-commit at gcc dot gnu.org
2023-04-19 11:53 ` rguenth at gcc dot gnu.org
2023-04-19 11:55 ` rguenth at gcc dot gnu.org
2010-07-02 23:54 [Bug tree-optimization/44794] New: " changpeng dot fang at amd dot com
2010-07-03 10:48 ` [Bug tree-optimization/44794] " rguenth at gcc dot gnu dot org
2010-07-06 17:59 ` changpeng dot fang at amd dot com
2010-07-06 18:36 ` changpeng dot fang at amd dot com
2010-07-15  1:50 ` changpeng dot fang at amd dot com

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-44794-4-JYdG2CH4C8@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).