This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

-Os vs moveables


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]