]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[RA]: Add cost calculation for reg equivalence invariants
authorVladimir N. Makarov <vmakarov@redhat.com>
Fri, 27 Oct 2023 12:28:24 +0000 (08:28 -0400)
committerVladimir N. Makarov <vmakarov@redhat.com>
Fri, 27 Oct 2023 14:19:28 +0000 (10:19 -0400)
My recent patch improving cost calculation for pseudos with equivalence
resulted in failure of gcc.target/arm/eliminate.c on aarch64.  This patch
fixes this failure.

gcc/ChangeLog:

* ira-costs.cc: (get_equiv_regno, calculate_equiv_gains):
Process reg equivalence invariants.

gcc/ira-costs.cc

index a59d45a6e24c6018ea18ec6544cd98cc9eeead2f..c40868070765d191ec7b9cfbe0da285a47ac8ce1 100644 (file)
@@ -1784,6 +1784,7 @@ get_equiv_regno (rtx x, int &regno, rtx &subreg)
     }
   if (REG_P (x)
       && (ira_reg_equiv[REGNO (x)].memory != NULL
+         || ira_reg_equiv[REGNO (x)].invariant != NULL
          || ira_reg_equiv[REGNO (x)].constant != NULL))
     {
       regno = REGNO (x);
@@ -1826,6 +1827,7 @@ calculate_equiv_gains (void)
   for (regno = max_reg_num () - 1; regno >= FIRST_PSEUDO_REGISTER; regno--)
     if (ira_reg_equiv[regno].init_insns != NULL
        && (ira_reg_equiv[regno].memory != NULL
+           || ira_reg_equiv[regno].invariant != NULL
            || (ira_reg_equiv[regno].constant != NULL
                /* Ignore complicated constants which probably will be placed
                   in memory:  */
@@ -1876,6 +1878,8 @@ calculate_equiv_gains (void)
 
          if (subst == NULL)
            subst = ira_reg_equiv[regno].constant;
+         if (subst == NULL)
+           subst = ira_reg_equiv[regno].invariant;
          ira_assert (subst != NULL);
          mode = PSEUDO_REGNO_MODE (regno);
          ira_init_register_move_cost_if_necessary (mode);