This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: optimizations
- From: Håkan Hjort <hakan at safelogic dot se>
- To: Zack Weinberg <zack at codesourcery dot com>
- Cc: Reza Roboubi <reza at linisoft dot com>, gcc at gcc dot gnu dot org
- Date: Tue, 18 Feb 2003 19:27:03 +0100
- Subject: Re: optimizations
- References: <Pine.LNX.4.21.0301151338040.30377-100000@mail.kloo.net> <3E25F2BB.BA90B2C9@linisoft.com> <20030218175524.GA8638@safelogic.se> <87vfzhwj6l.fsf@egil.codesourcery.com>
Tue Feb 18 2003, Zack Weinberg wrote:
> Håkan Hjort <hakan@safelogic.se> writes:
[snip]
>
> jmp .L2
> .p2align 4,,7
> .L9:
> incl %eax
> .L2:
> cmpl $16, %eax
> jne .L9
[snip]
>
> The unnecessary memory references are now gone, but the loop remains;
> also you can see what may appear to be a bug at first glance -- %eax
> is never initialized. This is not actually a correctness bug: no
> matter what value %eax happened to have before the loop, it will leave
> the loop with the value 16. However, I think you'll agree that this
> is poor optimization.
>
This might not be common enough to care about but...
We do know the exit vaule of a loop with no side effects, only one
exit edge and a EQ exit condition, it simply must be that value...
Though here we did have the start value too, k was set to 0.
Not having working loop hoisting/sinking seem like it could hurt
performace quite a bit. Though things are never so easy on modern CPUs
with store queues, load bypassing, register renaming, OO excution and
so on. What's clear is that the instruction count and text size will be
higher than needed.
Let's see if there is someone that can report on the loop-opt and/or
tree-ssa branches.
--
/Håkan