https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127244

--- Comment #9 from Uroš Bizjak <ubizjak at gmail dot com> ---
The IRA dump:
Popping a0(r109,l0) -- (memory is more profitable 3300 vs 7000) spill!

* r109 (flags) is live across the call, so its only candidates are the
callee-saved regs (%rbx and friends, hard regs 3, 6, 40-43).
* The cost of putting it in a hard reg is 7000. That cost includes the
prologue/epilogue save and restore of %rbx.
* The memory cost is 3300, so IRA spills it.

LRA then does:

* Because r109 is in memory, the asm output goes through a fresh reload reg
r114 (insn 46, r109 = r114). This happens with =r as well as =rm.
* Inheritance then replaces the stack slot with r116, which gets %rbx anyway.
Now rbx is in the prologue (the cost IRA tried to avoid) and also requires the
mov %rax,%rbx.

Reply via email to