public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/44794]  New: pre- and post-loops should not be unrolled.
@ 2010-07-02 23:54 changpeng dot fang at amd dot com
  2010-07-03 10:48 ` [Bug tree-optimization/44794] " rguenth at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: changpeng dot fang at amd dot com @ 2010-07-02 23:54 UTC (permalink / raw)
  To: gcc-bugs

void foo(int *a, int *b, int n)
{
  int i;
  for(i = 0; i < n; i++)
     a[i] = a[i] + b[i];
}

For this simple loop, the vectorizer does its job and peels the last few 
iterations as post-loop that is not vectorized. But the RTL loop unroller
does not know that it just has a few (at most 3 in this case) iterations,
and will unroll the post-loop.

What is worse, if you compile it with:
  gcc -O3 -fprefetch-loop-arrays -funroll-loops

You may find the prefetch pass will also unroll the post-loop, and generate
a new post-loop (post-post-loop) for this post-loop. Again, the RTL loop
unroller could not recognize this post-post-loop, and will unroll it.
(the RTL loop unroller will generate yet another post loop
(post-post-post-loop) for the post-post-loop :-))

 This will cause compilation time and code size increase dramastically without
any performance benefit.


-- 
           Summary: pre- and post-loops should not be unrolled.
           Product: gcc
           Version: lno
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: changpeng dot fang at amd dot com


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


^ permalink raw reply	[flat|nested] 9+ messages in thread
[parent not found: <bug-44794-4@http.gcc.gnu.org/bugzilla/>]

end of thread, other threads:[~2023-04-19 11:55 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-02 23:54 [Bug tree-optimization/44794] New: pre- and post-loops should not be unrolled 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
     [not found] <bug-44794-4@http.gcc.gnu.org/bugzilla/>
2023-03-09  8:06 ` rguenth at gcc dot gnu.org
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

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).