-Os vs moveables

Dale Johannesen dalej@apple.com
Mon Dec 9 12:36:00 GMT 2002


Currently the loop optimizer disables pulling things out of loops with 
-Os:

>   /* Now consider each movable insn to decide whether it is worth 
> moving.
>      Store 0 in regs->array[I].set_in_loop for each reg I that is 
> moved.
>
>      Generally this increases code size, so do not move moveables when
>      optimizing for code size.  */
>
>   if (! optimize_size)
>     {
>       move_movables (loop, movables, threshold, insn_count);

This was true in 2.95 as well.  Can somebody explain why it's doing 
this?
I don't believe the comment is correct in general, at least for RISCs.
If you're going to compute something into a register, it is no bulkier 
to
do it outside the loop.  I do see that pulling things out increases 
register
lifetimes and makes spilling more likely, but that consideration is not 
specific
to -Os.



More information about the Gcc mailing list