aboutsummaryrefslogtreecommitdiff
path: root/gcc/dwarf2out.cc
diff options
context:
space:
mode:
authorVladimir N. Makarov <vmakarov@redhat.com>2023-10-26 09:50:40 -0400
committerVladimir N. Makarov <vmakarov@redhat.com>2023-10-26 09:52:14 -0400
commitf55cdce3f8dd8503e080e35be59c5f5390f6d95e (patch)
tree4019459e65bb9504e4bf887fc77b8ace2b8b2248 /gcc/dwarf2out.cc
parent8d2130a4e5ce369f5884c8522934dc027db6e9d8 (diff)
downloadgcc-f55cdce3f8dd8503e080e35be59c5f5390f6d95e.zip
gcc-f55cdce3f8dd8503e080e35be59c5f5390f6d95e.tar.gz
gcc-f55cdce3f8dd8503e080e35be59c5f5390f6d95e.tar.bz2
[RA]: Modfify cost calculation for dealing with equivalences
RISCV target developers reported that pseudos with equivalence used in a loop can be spilled. Simple changes of heuristics of cost calculation of pseudos with equivalence or even ignoring equivalences resulted in numerous testsuite failures on different targets or worse spec2017 performance. This patch implements more sophisticated cost calculations of pseudos with equivalences. The patch does not change RA behaviour for targets still using the old reload pass instead of LRA. The patch solves the reported problem and improves x86-64 specint2017 a bit (specfp2017 performance stays the same). The patch takes into account how the equivalence will be used: will it be integrated into the user insns or require an input reload insn. It requires additional pass over insns. To compensate RA slow down, the patch removes a pass over insns in the reload pass used by IRA before. This also decouples IRA from reload more and will help to remove the reload pass in the future if it ever happens. gcc/ChangeLog: * dwarf2out.cc (reg_loc_descriptor): Use lra_eliminate_regs when LRA is used. * ira-costs.cc: Include regset.h. (equiv_can_be_consumed_p, get_equiv_regno, calculate_equiv_gains): New functions. (find_costs_and_classes): Call calculate_equiv_gains and redefine mem_cost of pseudos with equivs when LRA is used. * var-tracking.cc: Include ira.h and lra.h. (vt_initialize): Use lra_eliminate_regs when LRA is used.
Diffstat (limited to 'gcc/dwarf2out.cc')
-rw-r--r--gcc/dwarf2out.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/gcc/dwarf2out.cc b/gcc/dwarf2out.cc
index 0ea73bf..1e0cec6 100644
--- a/gcc/dwarf2out.cc
+++ b/gcc/dwarf2out.cc
@@ -14311,7 +14311,9 @@ reg_loc_descriptor (rtx rtl, enum var_init_status initialized)
argument pointer and soft frame pointer rtx's.
Use DW_OP_fbreg offset DW_OP_stack_value in this case. */
if ((rtl == arg_pointer_rtx || rtl == frame_pointer_rtx)
- && eliminate_regs (rtl, VOIDmode, NULL_RTX) != rtl)
+ && (ira_use_lra_p
+ ? lra_eliminate_regs (rtl, VOIDmode, NULL_RTX)
+ : eliminate_regs (rtl, VOIDmode, NULL_RTX)) != rtl)
{
dw_loc_descr_ref result = NULL;