------- Additional Comments From rth at gcc dot gnu dot org 2005-01-31 19:04 ------- I think you'll also want to try using -fno-gcse. The gcse pass is hoisting values out of your loop (as it is supposed to), except that we don't have enough registers to hold it all, so the values get spilled back to the stack. This is a known problem. If we had anything approaching a decent register allocator, we'd be able to move these values (known to be loop invariant) back inside the loop instead of spilling them.
Of course, we've got multiple passes that hoist values out of loops, and using -fno-gcse only prevents half of the spilled values from being moved. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19680