public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/19001] New: Loops with power of two step and variable bounds not unrolled
@ 2004-12-15 0:25 rakdver at gcc dot gnu dot org
2004-12-15 4:55 ` [Bug rtl-optimization/19001] [3.4/4.0 Regression] " pinskia at gcc dot gnu dot org
` (12 more replies)
0 siblings, 13 replies; 14+ messages in thread
From: rakdver at gcc dot gnu dot org @ 2004-12-15 0:25 UTC (permalink / raw)
To: gcc-bugs
Loop of the following form
int check(int a,int b, char *c)
{
for(;a<b;a+=4)
if(c[a]==1) return a;
return a;
}
(with step being power of two and > 1, and bounds variable) does not get unrolled.
It may happen that this loop is infinite, but this should not prevent unrolling.
--
Summary: Loops with power of two step and variable bounds not
unrolled
Product: gcc
Version: 4.0.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: normal
Priority: P2
Component: rtl-optimization
AssignedTo: rakdver at gcc dot gnu dot org
ReportedBy: rakdver at gcc dot gnu dot org
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19001
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug rtl-optimization/19001] [3.4/4.0 Regression] Loops with power of two step and variable bounds not unrolled
2004-12-15 0:25 [Bug rtl-optimization/19001] New: Loops with power of two step and variable bounds not unrolled rakdver at gcc dot gnu dot org
@ 2004-12-15 4:55 ` pinskia at gcc dot gnu dot org
2004-12-15 10:20 ` pcarlini at suse dot de
` (11 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-12-15 4:55 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-12-15 04:55 -------
Confirmed as a regression from 3.3.2, this happens in libstdc++ as mentioned other places.
And I also check that 3.3.2 did not unroll a loop with non power of two step aka:
int check(int a,int b, char *c)
{
for(;a<b;a+=5)
if(c[a]==1) return a;
return a;
}
is not unrolled in 3.3.2.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Known to work| |3.3.2
Last reconfirmed|0000-00-00 00:00:00 |2004-12-15 04:55:28
date| |
Summary|Loops with power of two step|[3.4/4.0 Regression] Loops
|and variable bounds not |with power of two step and
|unrolled |variable bounds not unrolled
Target Milestone|--- |3.4.4
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19001
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug rtl-optimization/19001] [3.4/4.0 Regression] Loops with power of two step and variable bounds not unrolled
2004-12-15 0:25 [Bug rtl-optimization/19001] New: Loops with power of two step and variable bounds not unrolled rakdver at gcc dot gnu dot org
2004-12-15 4:55 ` [Bug rtl-optimization/19001] [3.4/4.0 Regression] " pinskia at gcc dot gnu dot org
@ 2004-12-15 10:20 ` pcarlini at suse dot de
2004-12-15 12:28 ` chris at bubblescope dot net
` (10 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: pcarlini at suse dot de @ 2004-12-15 10:20 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pcarlini at suse dot de 2004-12-15 10:20 -------
To Zdenek and Andrew it's obvious, but maybe it's worth mentioning that the
following kind of loop, not involving explicitly power of two steps, pointers
instead, and *very* simple, is also not unrolled anymore:
int*
check(int* a, int* b)
{
for (; a < b; ++a)
if (*a == 1)
return a;
return a;
}
Maybe the Summary could be made a tad clearer
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |pcarlini at suse dot de
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19001
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug rtl-optimization/19001] [3.4/4.0 Regression] Loops with power of two step and variable bounds not unrolled
2004-12-15 0:25 [Bug rtl-optimization/19001] New: Loops with power of two step and variable bounds not unrolled rakdver at gcc dot gnu dot org
2004-12-15 4:55 ` [Bug rtl-optimization/19001] [3.4/4.0 Regression] " pinskia at gcc dot gnu dot org
2004-12-15 10:20 ` pcarlini at suse dot de
@ 2004-12-15 12:28 ` chris at bubblescope dot net
2004-12-15 12:52 ` rakdver at atrey dot karlin dot mff dot cuni dot cz
` (9 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: chris at bubblescope dot net @ 2004-12-15 12:28 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From chris at bubblescope dot net 2004-12-15 12:28 -------
Also (stating the perhaps blindingly obvious), this bug is not being caused by
the fact that the loop contains a return statement.
int check(int* a,int *b)
{
int* returnval=b;
for(;a<b;++a)
if(*a) returnval=a;
return returnval;
}
Also is not optimised.
Out of interest, surely when the loop actually involves pointers, then "looping
a pointer around the end of memory" is undefined behaviour, and therefore this
doesn't have to be considered in terms of optimising (although this won't help
the case in the original bug report).
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19001
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug rtl-optimization/19001] [3.4/4.0 Regression] Loops with power of two step and variable bounds not unrolled
2004-12-15 0:25 [Bug rtl-optimization/19001] New: Loops with power of two step and variable bounds not unrolled rakdver at gcc dot gnu dot org
` (2 preceding siblings ...)
2004-12-15 12:28 ` chris at bubblescope dot net
@ 2004-12-15 12:52 ` rakdver at atrey dot karlin dot mff dot cuni dot cz
2004-12-16 9:18 ` rakdver at gcc dot gnu dot org
` (8 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: rakdver at atrey dot karlin dot mff dot cuni dot cz @ 2004-12-15 12:52 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From rakdver at atrey dot karlin dot mff dot cuni dot cz 2004-12-15 12:52 -------
Subject: Re: [3.4/4.0 Regression] Loops with power of two step and variable bounds not unrolled
> ------- Additional Comments From chris at bubblescope dot net 2004-12-15 12:28 -------
> Also (stating the perhaps blindingly obvious), this bug is not being caused by
> the fact that the loop contains a return statement.
>
> int check(int* a,int *b)
> {
> int* returnval=b;
> for(;a<b;++a)
> if(*a) returnval=a;
> return returnval;
> }
>
> Also is not optimised.
>
> Out of interest, surely when the loop actually involves pointers, then "looping
> a pointer around the end of memory" is undefined behaviour, and therefore this
> doesn't have to be considered in terms of optimising (although this won't help
> the case in the original bug report).
And it won't help at all, since on rtl we no longer have a reliable
information about pointers.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19001
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug rtl-optimization/19001] [3.4/4.0 Regression] Loops with power of two step and variable bounds not unrolled
2004-12-15 0:25 [Bug rtl-optimization/19001] New: Loops with power of two step and variable bounds not unrolled rakdver at gcc dot gnu dot org
` (3 preceding siblings ...)
2004-12-15 12:52 ` rakdver at atrey dot karlin dot mff dot cuni dot cz
@ 2004-12-16 9:18 ` rakdver at gcc dot gnu dot org
2004-12-18 19:20 ` chris at bubblescope dot net
` (7 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: rakdver at gcc dot gnu dot org @ 2004-12-16 9:18 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From rakdver at gcc dot gnu dot org 2004-12-16 09:18 -------
Patch:
http://gcc.gnu.org/ml/gcc-patches/2004-12/msg01203.html
--
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |patch
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19001
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug rtl-optimization/19001] [3.4/4.0 Regression] Loops with power of two step and variable bounds not unrolled
2004-12-15 0:25 [Bug rtl-optimization/19001] New: Loops with power of two step and variable bounds not unrolled rakdver at gcc dot gnu dot org
` (4 preceding siblings ...)
2004-12-16 9:18 ` rakdver at gcc dot gnu dot org
@ 2004-12-18 19:20 ` chris at bubblescope dot net
2004-12-18 20:14 ` cvs-commit at gcc dot gnu dot org
` (6 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: chris at bubblescope dot net @ 2004-12-18 19:20 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From chris at bubblescope dot net 2004-12-18 19:20 -------
I thought I'd post this here rather than as a new bug.. I will do if there isn't
a reply within a week or so.
A very similar regression is:
int check(int a,int b, char* c)
{
for(;a!=b;a+=4)
if(c[a]==1) return a;
return a;
}
ie where "a<b" is replaced with "a!=b". Is there a simple / similar fix for this?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19001
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug rtl-optimization/19001] [3.4/4.0 Regression] Loops with power of two step and variable bounds not unrolled
2004-12-15 0:25 [Bug rtl-optimization/19001] New: Loops with power of two step and variable bounds not unrolled rakdver at gcc dot gnu dot org
` (5 preceding siblings ...)
2004-12-18 19:20 ` chris at bubblescope dot net
@ 2004-12-18 20:14 ` cvs-commit at gcc dot gnu dot org
2004-12-18 20:28 ` rakdver at gcc dot gnu dot org
` (5 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-12-18 20:14 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2004-12-18 20:14 -------
Subject: Bug 19001
CVSROOT: /cvs/gcc
Module name: gcc
Changes by: rakdver@gcc.gnu.org 2004-12-18 20:14:25
Modified files:
gcc : ChangeLog loop-iv.c
Log message:
PR rtl-optimization/19001
* loop-iv.c (iv_number_of_iterations): Record assumptions for loops
with power of two step to 'infinite' field.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.6880&r2=2.6881
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/loop-iv.c.diff?cvsroot=gcc&r1=2.24&r2=2.25
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19001
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug rtl-optimization/19001] [3.4/4.0 Regression] Loops with power of two step and variable bounds not unrolled
2004-12-15 0:25 [Bug rtl-optimization/19001] New: Loops with power of two step and variable bounds not unrolled rakdver at gcc dot gnu dot org
` (6 preceding siblings ...)
2004-12-18 20:14 ` cvs-commit at gcc dot gnu dot org
@ 2004-12-18 20:28 ` rakdver at gcc dot gnu dot org
2004-12-18 20:42 ` [Bug rtl-optimization/19001] [3.4 " pinskia at gcc dot gnu dot org
` (4 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: rakdver at gcc dot gnu dot org @ 2004-12-18 20:28 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From rakdver at gcc dot gnu dot org 2004-12-18 20:28 -------
What regression do you observe in that testcase? It gets unrolled just fine for
me.
If there is some other problem, please be more specific (and probably also
create a new PR for it).
Closing this one as fixed.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19001
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug rtl-optimization/19001] [3.4 Regression] Loops with power of two step and variable bounds not unrolled
2004-12-15 0:25 [Bug rtl-optimization/19001] New: Loops with power of two step and variable bounds not unrolled rakdver at gcc dot gnu dot org
` (7 preceding siblings ...)
2004-12-18 20:28 ` rakdver at gcc dot gnu dot org
@ 2004-12-18 20:42 ` pinskia at gcc dot gnu dot org
2004-12-19 10:59 ` chris at bubblescope dot net
` (3 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-12-18 20:42 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-12-18 20:42 -------
Reopening as it is a still a 3.4 regression.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |REOPENED
Known to work|3.3.2 |3.3.2 4.0.0
Resolution|FIXED |
Summary|[3.4/4.0 Regression] Loops |[3.4 Regression] Loops with
|with power of two step and |power of two step and
|variable bounds not unrolled|variable bounds not unrolled
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19001
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug rtl-optimization/19001] [3.4 Regression] Loops with power of two step and variable bounds not unrolled
2004-12-15 0:25 [Bug rtl-optimization/19001] New: Loops with power of two step and variable bounds not unrolled rakdver at gcc dot gnu dot org
` (8 preceding siblings ...)
2004-12-18 20:42 ` [Bug rtl-optimization/19001] [3.4 " pinskia at gcc dot gnu dot org
@ 2004-12-19 10:59 ` chris at bubblescope dot net
2004-12-20 11:46 ` giovannibajo at libero dot it
` (2 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: chris at bubblescope dot net @ 2004-12-19 10:59 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From chris at bubblescope dot net 2004-12-19 10:59 -------
Sorry, I was testing for the existance of loop-unrolling by timing, rather than
looking at the code.
The compiler is unrolling the code I provided, but then optimised quite badly.
As this might not be the fault of the loop optimiser, but some other piece of
code, I have opened a new bug report for it: 19078
Sorry for the inconvience.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19001
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug rtl-optimization/19001] [3.4 Regression] Loops with power of two step and variable bounds not unrolled
2004-12-15 0:25 [Bug rtl-optimization/19001] New: Loops with power of two step and variable bounds not unrolled rakdver at gcc dot gnu dot org
` (9 preceding siblings ...)
2004-12-19 10:59 ` chris at bubblescope dot net
@ 2004-12-20 11:46 ` giovannibajo at libero dot it
2005-02-12 22:35 ` pinskia at gcc dot gnu dot org
2005-05-19 17:46 ` mmitchel at gcc dot gnu dot org
12 siblings, 0 replies; 14+ messages in thread
From: giovannibajo at libero dot it @ 2004-12-20 11:46 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From giovannibajo at libero dot it 2004-12-20 11:46 -------
Notice that no testcase was added to 4.0 either.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19001
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug rtl-optimization/19001] [3.4 Regression] Loops with power of two step and variable bounds not unrolled
2004-12-15 0:25 [Bug rtl-optimization/19001] New: Loops with power of two step and variable bounds not unrolled rakdver at gcc dot gnu dot org
` (10 preceding siblings ...)
2004-12-20 11:46 ` giovannibajo at libero dot it
@ 2005-02-12 22:35 ` pinskia at gcc dot gnu dot org
2005-05-19 17:46 ` mmitchel at gcc dot gnu dot org
12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-02-12 22:35 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Status|REOPENED |ASSIGNED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19001
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug rtl-optimization/19001] [3.4 Regression] Loops with power of two step and variable bounds not unrolled
2004-12-15 0:25 [Bug rtl-optimization/19001] New: Loops with power of two step and variable bounds not unrolled rakdver at gcc dot gnu dot org
` (11 preceding siblings ...)
2005-02-12 22:35 ` pinskia at gcc dot gnu dot org
@ 2005-05-19 17:46 ` mmitchel at gcc dot gnu dot org
12 siblings, 0 replies; 14+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2005-05-19 17:46 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|3.4.4 |3.4.5
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19001
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2005-05-19 17:42 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-12-15 0:25 [Bug rtl-optimization/19001] New: Loops with power of two step and variable bounds not unrolled rakdver at gcc dot gnu dot org
2004-12-15 4:55 ` [Bug rtl-optimization/19001] [3.4/4.0 Regression] " pinskia at gcc dot gnu dot org
2004-12-15 10:20 ` pcarlini at suse dot de
2004-12-15 12:28 ` chris at bubblescope dot net
2004-12-15 12:52 ` rakdver at atrey dot karlin dot mff dot cuni dot cz
2004-12-16 9:18 ` rakdver at gcc dot gnu dot org
2004-12-18 19:20 ` chris at bubblescope dot net
2004-12-18 20:14 ` cvs-commit at gcc dot gnu dot org
2004-12-18 20:28 ` rakdver at gcc dot gnu dot org
2004-12-18 20:42 ` [Bug rtl-optimization/19001] [3.4 " pinskia at gcc dot gnu dot org
2004-12-19 10:59 ` chris at bubblescope dot net
2004-12-20 11:46 ` giovannibajo at libero dot it
2005-02-12 22:35 ` pinskia at gcc dot gnu dot org
2005-05-19 17:46 ` mmitchel at gcc dot gnu dot 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).