[gcc(refs/vendors/riscv/heads/gcc-13-with-riscv-opts)] Revert "[RA]: Improve cost calculation of pseudos with equivalences"

Jeff Law law@gcc.gnu.org
Mon Oct 9 12:50:23 GMT 2023


https://gcc.gnu.org/g:3a6b4eb426337d1b6cb04f469f8a8b0054e5ba09

commit 3a6b4eb426337d1b6cb04f469f8a8b0054e5ba09
Author: Vladimir N. Makarov <vmakarov@redhat.com>
Date:   Thu Sep 28 11:53:51 2023 -0400

    Revert "[RA]: Improve cost calculation of pseudos with equivalences"
    
    This reverts commit 3c834d85f2ec42c60995c2b678196a06cb744959.
    
    Although the patch improves x86-64 specfp2007, it also results in
    performance and code size regression on different targets and
    new GCC testsuite failures on tests expecting a specific output.
    
    (cherry picked from commit 8552dcd8e4448c02fe230662093756b75dd94399)

Diff:
---
 gcc/ira-costs.cc | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/gcc/ira-costs.cc b/gcc/ira-costs.cc
index 52c9c0b7608..bdb1356af91 100644
--- a/gcc/ira-costs.cc
+++ b/gcc/ira-costs.cc
@@ -1940,8 +1940,15 @@ find_costs_and_classes (FILE *dump_file)
 	    }
 	  if (i >= first_moveable_pseudo && i < last_moveable_pseudo)
 	    i_mem_cost = 0;
-	  else
-	    i_mem_cost -= equiv_savings;
+	  else if (equiv_savings < 0)
+	    i_mem_cost = -equiv_savings;
+	  else if (equiv_savings > 0)
+	    {
+	      i_mem_cost = 0;
+	      for (k = cost_classes_ptr->num - 1; k >= 0; k--)
+		i_costs[k] += equiv_savings;
+	    }
+
 	  best_cost = (1 << (HOST_BITS_PER_INT - 2)) - 1;
 	  best = ALL_REGS;
 	  alt_class = NO_REGS;


More information about the Gcc-cvs mailing list