http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54133
--- Comment #4 from Steven Bosscher <steven at gcc dot gnu.org> 2012-08-01 11:58:00 UTC --- Created attachment 27918 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27918 Hack regmove to do limited propagation of hard regs I have a patch to make the propagation happen in regmove, resulting in the following RTL in the IRA dump: 78 r177:DF=r0:DF 80 [sp:SI]=r166:DF 81 [sp:SI+0x8]=r168:DF 82 [sp:SI+0x10]=r170:DF 84 r2:DF=r164:DF 85 r0:DF=call [`bar'] argc:0x18 REG_DEAD: r2:DF REG_UNUSED: r0:DF 86 [sp:SI]=r167:DF 87 [sp:SI+0x8]=r169:DF 88 [sp:SI+0x10]=r171:DF 89 r0:DF=r177:DF REG_DEAD: r177:DF 90 r2:DF=r165:DF 91 r0:DF=call [`bar'] argc:0x18 But now IRA decides to spill r177 to memory: Allocno a5r177 of GENERAL_REGS(9) has 4 avail. regs 4-7, node: 4-7 obj 0 (confl regs = 0-3 8-102), obj 1 (confl regs = 0-3 8-102) Pushing a5(r177,l0)(potential spill: pri=469, cost=38000) Making a1(r159,l0) colorable Making a2(r172,l0) colorable Making a3(r163,l0) colorable Pushing a1(r159,l0)(cost 32000) Pushing a3(r163,l0)(cost 40000) Pushing a2(r172,l0)(cost 88000) Popping a2(r172,l0) -- assign reg 4 Popping a3(r163,l0) -- assign reg 5 Popping a1(r159,l0) -- assign reg 6 Popping a5(r177,l0) -- (memory is more profitable 32000 vs 2147483647) spill Popping a0(r175,l0) -- assign reg 7 This makes the inner loop 2 instructions smaller, but I haven't investigated whether that's an improvement or not.