diff mbox series

[pushed,PR115013,LRA] : Modify register starvation recognition

Message ID c98e5511-8b26-4480-8473-20a8e0bd2016@redhat.com
State New
Headers show
Series [pushed,PR115013,LRA] : Modify register starvation recognition | expand

Commit Message

Vladimir Makarov May 13, 2024, 3:19 p.m. UTC
The following patch fixes

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

Successfully tested and bootstrapped on x86-64.
diff mbox series

Patch

commit 44430ef3d8ba75692efff5f6969d5610134566d3
Author: Vladimir N. Makarov <vmakarov@redhat.com>
Date:   Mon May 13 10:12:11 2024 -0400

    [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.

diff --git a/gcc/lra-constraints.cc b/gcc/lra-constraints.cc
index e945a4da451..92b343fa99a 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]))