[Bug c/19676] New: Loop optimizer fails to reverse simple loop
andrewhutchinson at cox dot net
gcc-bugzilla@gcc.gnu.org
Fri Jan 28 19:08:00 GMT 2005
AVR Target 20041205 snapshot
gcc version 4.0.0 20041205 (experimental)
/avrdev/libexec/gcc/avr/4.0.0/cc1.exe -quiet -v looprv.c -quiet -dumpbase
looprv.c -mmcu=atmega169 -auxbase looprv -Os -Wall -version -funsigned-char
-funsigned-bitfields -fpack-struct -fshort-enums -o looprv.s
Loop optimiser fails to reverse simple loop. Example
void testloop5(void)
{
int i;
for (i=0;i<100;i++)
{
if (!value)
{
foo();
}
}
}
generates RTL setting index to 100 then using decrement/branch at end of loop as
expected. However, adding any kind of while/for loop inside outer loop leaves
index unoptimised. For example
void testloop3(void)
{
int i;
for (i=0;i<100;i++)
{
while (!value)
{
foo();
}
}
}
Here index starts at 0 and increments to 99.
Problem seems to be related to "maybe_multiple" being set in loop scan. However,
since 'i' is never used inside loop there would seem to be no need to check for
multiple setting.
This was tested with AVR target but looks like it will affect any target - I can
provide RTL etc on demand.
--
Summary: Loop optimizer fails to reverse simple loop
Product: gcc
Version: 4.0.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: andrewhutchinson at cox dot net
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19676
More information about the Gcc-bugs
mailing list