From: Vladimir N. Makarov Date: Wed, 19 Mar 2025 20:06:41 +0000 (-0400) Subject: [PR119270][IRA]: Ignore equiv init insns for cost calculation for invariants only X-Git-Tag: basepoints/gcc-16~1104 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6c443e128802bd93158a3db7c4edf5fc1fc76c8d;p=thirdparty%2Fgcc.git [PR119270][IRA]: Ignore equiv init insns for cost calculation for invariants only My previous patch for PR114991 contains code ignoring equiv init insns for increasing cost of usage the equivalence. Although common sense says it is right thing to do, this results in more aggressive usage of memory equivalence and significant performance degradation of SPEC2017 cactuBSSM. Given patch restores previous cost calculation for all equivalences except for invariant ones. gcc/ChangeLog: PR target/119270 * ira-costs.cc (calculate_equiv_gains): Ignore equiv init insns only for invariants. --- diff --git a/gcc/ira-costs.cc b/gcc/ira-costs.cc index 70cba942a7b..faf706ca5dd 100644 --- a/gcc/ira-costs.cc +++ b/gcc/ira-costs.cc @@ -1926,12 +1926,15 @@ calculate_equiv_gains (void) || !bitmap_bit_p (&equiv_pseudos, regno)) continue; - rtx_insn_list *x; - for (x = ira_reg_equiv[regno].init_insns; x != NULL; x = x->next ()) - if (insn == x->insn ()) - break; - if (x != NULL) - continue; /* skip equiv init insn */ + if (ira_reg_equiv[regno].invariant != NULL) + { + rtx_insn_list *x = ira_reg_equiv[regno].init_insns; + for (; x != NULL; x = x->next ()) + if (insn == x->insn ()) + break; + if (x != NULL) + continue; /* skip equiv init insn for invariant */ + } rtx subst = ira_reg_equiv[regno].memory;