https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119142
--- Comment #8 from H.J. Lu <hjl.tools at gmail dot com> --- Created attachment 60673 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=60673&action=edit A patch I am testing this with if (GENERAL_REGNO_P (hard_regno)) { /* push is 1 byte while typical spill is 4-5 bytes. ??? We probably should adjust size costs accordingly. Costs are relative to reg-reg move that has 2 bytes for 32bit and 3 bytes otherwise. Be sure that no cost table sets cost to 2, so we end up with 0. */ if (mem_cost <= 2 || optimize_function_for_size_p (cfun)) return 1; return mem_cost - 2; }