> From: Richard Sandiford via Gcc-patches <gcc-patches@gcc.gnu.org> > Date: Thu, 6 Jan 2022 15:48:01 +0100
> If an allocno A in an inner loop L spans a call, a parent allocno AP > can choose to handle a call-clobbered/caller-saved hard register R > in one of two ways: > > (1) save R before each call in L and restore R after each call > (2) spill R to memory throughout L > > (2) can be cheaper than (1) in some cases, particularly if L does > not reference A. > > Before the patch we always did (1). The patch adds support for > picking (2) instead, when it seems cheaper. It builds on the > earlier support for not propagating conflicts to parent allocnos. > > gcc/ > PR rtl-optimization/98782 > * ira-int.h (ira_caller_save_cost): New function. > (ira_caller_save_loop_spill_p): Likewise. > * ira-build.c (ira_propagate_hard_reg_costs): Test whether it is > cheaper to spill a call-clobbered register throughout a loop rather > than spill it around each individual call. If so, treat all > call-clobbered registers as conflicts and... > (propagate_allocno_info): ...do not propagate call information > from the child to the parent. > * ira-color.c (move_spill_restore): Update accordingly. > * ira-costs.c (ira_tune_allocno_costs): Use ira_caller_save_cost. I bisected a broken build for cris-elf to this patch. Details in https://gcc.gnu.org/PR103974 supposedly sufficient to find a quick resolution. (JFTR, as you're already CC:ed by your @gcc.gnu.org account.) Perhaps some of these patches are better postponed for stage 1? brgds, H-P