]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Revert "[RA]: Improve cost calculation of pseudos with equivalences"
authorVladimir N. Makarov <vmakarov@redhat.com>
Thu, 28 Sep 2023 15:53:51 +0000 (11:53 -0400)
committerVladimir N. Makarov <vmakarov@redhat.com>
Thu, 28 Sep 2023 15:57:45 +0000 (11:57 -0400)
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.

gcc/ira-costs.cc

index 8c93ace5094a94c4fb786258e712287be21f7d31..d9e700e894736c598094bd50557199b1327fee80 100644 (file)
@@ -1947,8 +1947,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;