[Bug c/19703] New: Poor optimisation of loop test
andrewhutchinson at cox dot net
gcc-bugzilla@gcc.gnu.org
Sun Jan 30 02:59:00 GMT 2005
Missed optimization
gcc version 4.0.0 20041205 (experimental)
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
Down counting loop, uses expensive compare EQ (-n) instead of compare >=0.
Testcase as follows:
volatile char value6;
extern void foo6(char);
void testloop6(void)
{
int i;
for (i=100;i>= 0;i-=10)
{
if (!value6)
{
foo6(i);
}
}
Loop test in RTL is compare NE -10. It should be compare GE 0 - which
is(generally) free. First dump of Expanded RTL show the compare.
--
Summary: Poor optimisation of loop test
Product: gcc
Version: 4.0.0
Status: UNCONFIRMED
Severity: minor
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=19703
More information about the Gcc-bugs
mailing list