* [Bug tree-optimization/19401] Trivial loop not unrolled
2005-01-12 16:08 [Bug tree-optimization/19401] New: Trivial loop not unrolled rguenth at tat dot physik dot uni-tuebingen dot de
@ 2005-01-12 16:10 ` rguenth at tat dot physik dot uni-tuebingen dot de
2005-01-12 16:14 ` pinskia at gcc dot gnu dot org
` (10 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: rguenth at tat dot physik dot uni-tuebingen dot de @ 2005-01-12 16:10 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
OtherBugsDependingO| |11706
nThis| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19401
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug tree-optimization/19401] Trivial loop not unrolled
2005-01-12 16:08 [Bug tree-optimization/19401] New: Trivial loop not unrolled rguenth at tat dot physik dot uni-tuebingen dot de
2005-01-12 16:10 ` [Bug tree-optimization/19401] " rguenth at tat dot physik dot uni-tuebingen dot de
@ 2005-01-12 16:14 ` pinskia at gcc dot gnu dot org
2005-01-12 16:19 ` rguenth at tat dot physik dot uni-tuebingen dot de
` (9 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-01-12 16:14 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-01-12 16:13 -------
Really -funroll-loops should be added to -O3 by default and maybe a tweewed version to -O2/-Os
(one which only unroll loops which can be unrolled fully and don't produce more code than the loop
itself).
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Keywords| |missed-optimization
Last reconfirmed|0000-00-00 00:00:00 |2005-01-12 16:13:54
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19401
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug tree-optimization/19401] Trivial loop not unrolled
2005-01-12 16:08 [Bug tree-optimization/19401] New: Trivial loop not unrolled rguenth at tat dot physik dot uni-tuebingen dot de
2005-01-12 16:10 ` [Bug tree-optimization/19401] " rguenth at tat dot physik dot uni-tuebingen dot de
2005-01-12 16:14 ` pinskia at gcc dot gnu dot org
@ 2005-01-12 16:19 ` rguenth at tat dot physik dot uni-tuebingen dot de
2005-01-12 16:21 ` pinskia at gcc dot gnu dot org
` (8 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: rguenth at tat dot physik dot uni-tuebingen dot de @ 2005-01-12 16:19 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From rguenth at tat dot physik dot uni-tuebingen dot de 2005-01-12 16:19 -------
In 3.4 one was able to do this by specifying -fpeel-loops and got complete loop
peeling enabled. In 4.0 this is also the case, but only for the RTL unroller -
the tree unroller is not affected and as such _this_ unrolling does not help
PR11706. - Just another datapoint.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19401
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug tree-optimization/19401] Trivial loop not unrolled
2005-01-12 16:08 [Bug tree-optimization/19401] New: Trivial loop not unrolled rguenth at tat dot physik dot uni-tuebingen dot de
` (2 preceding siblings ...)
2005-01-12 16:19 ` rguenth at tat dot physik dot uni-tuebingen dot de
@ 2005-01-12 16:21 ` pinskia at gcc dot gnu dot org
2005-01-12 16:24 ` rguenth at tat dot physik dot uni-tuebingen dot de
` (7 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-01-12 16:21 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-01-12 16:21 -------
Another trivial loop which is not unrolled but should be:
int f(int x)
{
int i, x1;
x1 = x;
for(i = 0;i<2;i++)
x1 *= x1;
return x1;
}
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19401
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug tree-optimization/19401] Trivial loop not unrolled
2005-01-12 16:08 [Bug tree-optimization/19401] New: Trivial loop not unrolled rguenth at tat dot physik dot uni-tuebingen dot de
` (3 preceding siblings ...)
2005-01-12 16:21 ` pinskia at gcc dot gnu dot org
@ 2005-01-12 16:24 ` rguenth at tat dot physik dot uni-tuebingen dot de
2005-01-12 17:05 ` gdr at integrable-solutions dot net
` (6 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: rguenth at tat dot physik dot uni-tuebingen dot de @ 2005-01-12 16:24 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From rguenth at tat dot physik dot uni-tuebingen dot de 2005-01-12 16:24 -------
Or stuff often found in C++ libraries:
template <int Dim>
struct Vector
{
Vector(float init)
{
for (int i=0; i<Dim; ++i)
v[i] = init;
}
float v[Dim];
};
for small Dim (<= 4 should make nearly everyone happy) you want all the
dimension-unaware loops to be unrolled.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19401
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug tree-optimization/19401] Trivial loop not unrolled
2005-01-12 16:08 [Bug tree-optimization/19401] New: Trivial loop not unrolled rguenth at tat dot physik dot uni-tuebingen dot de
` (4 preceding siblings ...)
2005-01-12 16:24 ` rguenth at tat dot physik dot uni-tuebingen dot de
@ 2005-01-12 17:05 ` gdr at integrable-solutions dot net
2005-01-12 17:06 ` gdr at integrable-solutions dot net
` (5 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: gdr at integrable-solutions dot net @ 2005-01-12 17:05 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From gdr at integrable-solutions dot net 2005-01-12 17:05 -------
Subject: Re: Trivial loop not unrolled
"pinskia at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> writes:
| Really -funroll-loops should be added to -O3 by default and maybe a
| tweewed version to -O2/-Os
I don't think the issue is to have -funroll-loops as default at higher
level. I think it is more about the compiler understanding loops with
constant bounds, just like we handle if(0) or if(1) branches.
-- Gaby
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19401
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug tree-optimization/19401] Trivial loop not unrolled
2005-01-12 16:08 [Bug tree-optimization/19401] New: Trivial loop not unrolled rguenth at tat dot physik dot uni-tuebingen dot de
` (5 preceding siblings ...)
2005-01-12 17:05 ` gdr at integrable-solutions dot net
@ 2005-01-12 17:06 ` gdr at integrable-solutions dot net
2005-01-13 13:48 ` pinskia at gcc dot gnu dot org
` (4 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: gdr at integrable-solutions dot net @ 2005-01-12 17:06 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From gdr at integrable-solutions dot net 2005-01-12 17:06 -------
Subject: Re: Trivial loop not unrolled
"rguenth at tat dot physik dot uni-tuebingen dot de" <gcc-bugzilla@gcc.gnu.org> writes:
| Or stuff often found in C++ libraries:
|
| template <int Dim>
| struct Vector
| {
| Vector(float init)
| {
| for (int i=0; i<Dim; ++i)
| v[i] = init;
| }
| float v[Dim];
| };
|
| for small Dim (<= 4 should make nearly everyone happy) you want all the
| dimension-unaware loops to be unrolled.
I agree.
-- Gaby
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19401
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug tree-optimization/19401] Trivial loop not unrolled
2005-01-12 16:08 [Bug tree-optimization/19401] New: Trivial loop not unrolled rguenth at tat dot physik dot uni-tuebingen dot de
` (6 preceding siblings ...)
2005-01-12 17:06 ` gdr at integrable-solutions dot net
@ 2005-01-13 13:48 ` pinskia at gcc dot gnu dot org
2005-01-14 9:04 ` rakdver at gcc dot gnu dot org
` (3 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-01-13 13:48 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |pinskia at gcc dot gnu dot
| |org
Severity|normal |enhancement
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19401
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug tree-optimization/19401] Trivial loop not unrolled
2005-01-12 16:08 [Bug tree-optimization/19401] New: Trivial loop not unrolled rguenth at tat dot physik dot uni-tuebingen dot de
` (7 preceding siblings ...)
2005-01-13 13:48 ` pinskia at gcc dot gnu dot org
@ 2005-01-14 9:04 ` rakdver at gcc dot gnu dot org
2005-01-24 9:43 ` rguenth at tat dot physik dot uni-tuebingen dot de
` (2 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: rakdver at gcc dot gnu dot org @ 2005-01-14 9:04 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From rakdver at gcc dot gnu dot org 2005-01-14 09:04 -------
Other possible patch:
http://gcc.gnu.org/ml/gcc-patches/2005-01/msg00796.html
--
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |patch
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19401
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug tree-optimization/19401] Trivial loop not unrolled
2005-01-12 16:08 [Bug tree-optimization/19401] New: Trivial loop not unrolled rguenth at tat dot physik dot uni-tuebingen dot de
` (8 preceding siblings ...)
2005-01-14 9:04 ` rakdver at gcc dot gnu dot org
@ 2005-01-24 9:43 ` rguenth at tat dot physik dot uni-tuebingen dot de
2005-05-06 21:11 ` cvs-commit at gcc dot gnu dot org
2005-05-07 19:56 ` pinskia at gcc dot gnu dot org
11 siblings, 0 replies; 13+ messages in thread
From: rguenth at tat dot physik dot uni-tuebingen dot de @ 2005-01-24 9:43 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From rguenth at tat dot physik dot uni-tuebingen dot de 2005-01-24 09:43 -------
Another one - matrix multiplication:
/* A [NxM], B [MxP] */
#define DOLOOP(N, M, P) \
void matmul ## N ## M ## P(double *res, const double *A, const double *B) \
{ \
int i,j,k; \
for (k=0; k<P; ++k) \
for (i=0; i<N; ++i) { \
double s = 0.0; \
for (j=0; j<M; ++j) \
s += A[i*M+j] * B[j*P+k]; \
res[i*P+k] = s; \
} \
}
DOLOOP(1, 1, 1)
DOLOOP(2, 1, 2)
DOLOOP(1, 2, 1)
DOLOOP(2, 2, 2)
DOLOOP(1, 3, 1)
DOLOOP(1, 1024, 1)
all up to 2x2 should be profitable to completely unroll. Be sure to unroll
one-time rolling loops like for the last case.
Zdeneks patch only does not unroll the DOLOOP(2, 2, 2) case at -O2. Good.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19401
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug tree-optimization/19401] Trivial loop not unrolled
2005-01-12 16:08 [Bug tree-optimization/19401] New: Trivial loop not unrolled rguenth at tat dot physik dot uni-tuebingen dot de
` (9 preceding siblings ...)
2005-01-24 9:43 ` rguenth at tat dot physik dot uni-tuebingen dot de
@ 2005-05-06 21:11 ` cvs-commit at gcc dot gnu dot org
2005-05-07 19:56 ` pinskia at gcc dot gnu dot org
11 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-05-06 21:11 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2005-05-06 21:11 -------
Subject: Bug 19401
CVSROOT: /cvs/gcc
Module name: gcc
Changes by: rakdver@gcc.gnu.org 2005-05-06 21:11:29
Modified files:
gcc : ChangeLog tree-flow.h tree-ssa-loop-ivcanon.c
tree-ssa-loop.c
Log message:
PR tree-optimization/19401
* tree-flow.h (tree_unroll_loops_completely): Declaration changed.
* tree-ssa-loop-ivcanon.c (enum unroll_level): New.
(estimated_unrolled_size): New function.
(try_unroll_loop_completely, canonicalize_loop_induction_variables,
tree_unroll_loops_completely): Always unroll loops if the code size
does not increase.
* tree-ssa-loop.c (tree_complete_unroll): Indicate whether all
loops should be unrolled completely.
(gate_tree_complete_unroll): Run complete unrolling unconditionally.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.8629&r2=2.8630
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree-flow.h.diff?cvsroot=gcc&r1=2.101&r2=2.102
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree-ssa-loop-ivcanon.c.diff?cvsroot=gcc&r1=2.11&r2=2.12
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree-ssa-loop.c.diff?cvsroot=gcc&r1=2.28&r2=2.29
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19401
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug tree-optimization/19401] Trivial loop not unrolled
2005-01-12 16:08 [Bug tree-optimization/19401] New: Trivial loop not unrolled rguenth at tat dot physik dot uni-tuebingen dot de
` (10 preceding siblings ...)
2005-05-06 21:11 ` cvs-commit at gcc dot gnu dot org
@ 2005-05-07 19:56 ` pinskia at gcc dot gnu dot org
11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-05-07 19:56 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-05-07 19:56 -------
Fixed.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
Target Milestone|--- |4.1.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19401
^ permalink raw reply [flat|nested] 13+ messages in thread