https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119142
--- Comment #7 from H.J. Lu <hjl.tools at gmail dot com> ---
Something like
diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc
index 661e71b032c..8e599bb22fc 100644
--- a/gcc/config/i386/i386.cc
+++ b/gcc/config/i386/i386.cc
@@ -20613,11 +20613,10 @@ ix86_callee_save_cost (spill_cost_type, unsigned int
hard_regno, machine_mode,
/* 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. */
- if (optimize_function_for_size_p (cfun))
+ 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;
- /* Be sure that no cost table sets cost to 2, so we end up with 0. */
- gcc_checking_assert (mem_cost > 2);
return mem_cost - 2;
}
return mem_cost;