This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Inner-loop optimization regression from 3.3 to 3.4
- From: "Zack Weinberg" <zack at codesourcery dot com>
- To: gcc at gcc dot gnu dot org
- Cc: Jan Hubicka <hubicka at ucw dot cz>
- Date: Sun, 12 Oct 2003 23:04:56 -0700
- Subject: Re: Inner-loop optimization regression from 3.3 to 3.4
- References: <87vfqt66ge.fsf@codesourcery.com>
"Zack Weinberg" <zack@codesourcery.com> writes:
> I wanted a break from machine modes so I thought I'd squeeze some
> cycles out of _cpp_skip_block_comment. In the process I discovered
> a serious optimization regression in 3.4, relative to 3.3.
I have now discovered that writing instead
for (;;)
{
c = *cur++;
if (c == '/')
{
if (cur[-2] == '*'
break;
foo();
}
else if (c == '\n')
bar();
}
-- the same thing but without the inner do-while -- generates much
better code:
.L350:
incl %ebx
cmpb $47, %al
je .L352
.p2align 4,,15
.L339:
cmpb $10, %al
je .L353
.L346:
movzbl (%ebx), %eax
.L354:
incl %ebx
cmpb $47, %al
jne .L339
No redundant comparisons and mucking around with setcc, and it's even
managed to rotate the loop so there's only two branches.
So I'm going to check in the code like this; if you want to see the
problem as it was, just put back the do-while.
zw