summaryrefslogtreecommitdiff
path: root/0087-Add-cost-calculation-for-reg-equivalence-invariants.patch
diff options
context:
space:
mode:
Diffstat (limited to '0087-Add-cost-calculation-for-reg-equivalence-invariants.patch')
-rw-r--r--0087-Add-cost-calculation-for-reg-equivalence-invariants.patch49
1 files changed, 49 insertions, 0 deletions
diff --git a/0087-Add-cost-calculation-for-reg-equivalence-invariants.patch b/0087-Add-cost-calculation-for-reg-equivalence-invariants.patch
new file mode 100644
index 0000000..9315409
--- /dev/null
+++ b/0087-Add-cost-calculation-for-reg-equivalence-invariants.patch
@@ -0,0 +1,49 @@
+From 4965473a4211a9feb46a0d168180ab450cb18bcc Mon Sep 17 00:00:00 2001
+From: "Vladimir N. Makarov" <vmakarov@redhat.com>
+Date: Fri, 27 Oct 2023 08:28:24 -0400
+Subject: [PATCH 32/32] Add cost calculation for reg equivalence invariants
+
+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 | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/gcc/ira-costs.cc b/gcc/ira-costs.cc
+index c79311783..d33104a30 100644
+--- a/gcc/ira-costs.cc
++++ b/gcc/ira-costs.cc
+@@ -1777,6 +1777,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);
+@@ -1819,6 +1820,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: */
+@@ -1869,6 +1871,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);
+--
+2.28.0.windows.1
+