Bug 29946 - inept unrolling for small iteration counts
Summary: inept unrolling for small iteration counts
Status: RESOLVED WONTFIX
Alias: None
Product: gcc
Classification: Unclassified
Component: rtl-optimization (show other bugs)
Version: 4.3.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: missed-optimization
Depends on:
Blocks: 29842
  Show dependency tree / graph
 
Reported: 2006-11-22 19:47 UTC by Jorn Wolfgang Rennecke
Modified: 2013-12-24 23:56 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jorn Wolfgang Rennecke 2006-11-22 19:47:42 UTC
When profile based feedback indicates that a loop has a low iteration
count, it will often refuse to unroll even though unrolling is still
useful.  Moreover, while it knows about the average loop iteration
count, it lacks the concept of a prevalent iteration count.

In particular, the header checksumming of the EEMBC packetflow benchmark
usually has ten iterations.  With gcc 3.x, unrolling was by a factor of four,
which was mediocre.  With the introduction of the new loop unroller in 4.0,
unrolling when doing profile feedback was no longer done at all.
The proper thing to do would be to unroll this loop five times.

When the case of a loop that is not a multiple of the chosen unroll factor is
deemed sufficiently unlikely, that case can be taken care of by generating
a non-unrolled loop after the unrolled loop.  The unrolled loop can use
a suitably transformed unequality check for the loop start and end to
verify that a sufficient number of iterations is outstanding, so that no
casesi / tablejump code is needed.

See also: http://gcc.gnu.org/ml/gcc-patches/2004-09/msg02373.html
Comment 1 Drea Pinski 2006-11-22 19:49:40 UTC
> With the introduction of the new loop unroller in 4.0,
I think you mean 3.4.0 because the new unroller was in 3.4.0.
Comment 2 Jorn Wolfgang Rennecke 2006-11-22 20:10:05 UTC
(In reply to comment #1)
> > With the introduction of the new loop unroller in 4.0,
> I think you mean 3.4.0 because the new unroller was in 3.4.0.
> 

You're right, it was introduced then.  Although the old loop unroller
was still present in 3.4.0 and could be selected with a flag - which
was useful to get avoid performance regressions.
Comment 3 Steven Bosscher 2013-12-24 23:56:34 UTC
Old bug without test case => closed