From 44e7855e4e817a7f5a1e332cd95e780e57052dba Mon Sep 17 00:00:00 2001 From: "Vladimir N. Makarov" Date: Mon, 13 May 2024 10:12:11 -0400 Subject: [PR115013][LRA]: Modify register starvation recognition My recent patch to recognize reg starvation resulted in few GCC test failures. The following patch fixes this by using more accurate starvation calculation and ignoring small reg classes. gcc/ChangeLog: PR rtl-optimization/115013 * lra-constraints.cc (process_alt_operands): Update all_used_nregs only for winreg. Ignore reg starvation for small reg classes. --- gcc/lra-constraints.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'gcc') diff --git a/gcc/lra-constraints.cc b/gcc/lra-constraints.cc index e945a4d..92b343f 100644 --- a/gcc/lra-constraints.cc +++ b/gcc/lra-constraints.cc @@ -2674,8 +2674,9 @@ process_alt_operands (int only_alternative) if (early_clobber_p || curr_static_id->operand[nop].type != OP_OUT) { - all_used_nregs - += ira_reg_class_min_nregs[this_alternative][mode]; + if (winreg) + all_used_nregs + += ira_reg_class_min_nregs[this_alternative][mode]; all_this_alternative = (reg_class_subunion [all_this_alternative][this_alternative]); @@ -3250,6 +3251,7 @@ process_alt_operands (int only_alternative) overall += LRA_MAX_REJECT; } if (all_this_alternative != NO_REGS + && !SMALL_REGISTER_CLASS_P (all_this_alternative) && all_used_nregs != 0 && all_reload_nregs != 0 && (all_used_nregs + all_reload_nregs + 1 >= ira_class_hard_regs_num[all_this_alternative])) -- cgit v1.1