aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkrebbel <krebbel@138bc75d-0d04-0410-961f-82ee72b054a4>2019-09-20 09:23:50 +0000
committerkrebbel <krebbel@138bc75d-0d04-0410-961f-82ee72b054a4>2019-09-20 09:23:50 +0000
commit08f8d17daed89c9b9b0802fece6f5eb42b2bba28 (patch)
tree131210a739ae8f5614116994794d072e2fe3f4fc
parentae21909faf644ba583f3f950e45a115733744292 (diff)
Fix PR88751
This patch implements a small improvement for the heuristic in lra which decides when it has to activate the simpler register allocation algorithm. gcc/ChangeLog: 2019-09-20 Andreas Krebbel <krebbel@linux.ibm.com> Backport from mainline 2019-06-06 Andreas Krebbel <krebbel@linux.ibm.com> PR rtl-optimization/88751 * ira.c (ira): Use the number of the actually referenced registers when calculating the threshold. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-7-branch@275993 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog9
-rw-r--r--gcc/ira.c9
2 files changed, 17 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index ad4384a37c3..533ab1c3f13 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,12 @@
+2019-09-20 Andreas Krebbel <krebbel@linux.ibm.com>
+
+ Backport from mainline
+ 2019-06-06 Andreas Krebbel <krebbel@linux.ibm.com>
+
+ PR rtl-optimization/88751
+ * ira.c (ira): Use the number of the actually referenced registers
+ when calculating the threshold.
+
2019-09-11 Eric Botcazou <ebotcazou@adacore.com>
PR rtl-optimization/89795
diff --git a/gcc/ira.c b/gcc/ira.c
index 5265ab17488..4925cc713b0 100644
--- a/gcc/ira.c
+++ b/gcc/ira.c
@@ -5160,6 +5160,8 @@ ira (FILE *f)
int ira_max_point_before_emit;
bool saved_flag_caller_saves = flag_caller_saves;
enum ira_region saved_flag_ira_region = flag_ira_region;
+ unsigned int i;
+ int num_used_regs = 0;
clear_bb_flags ();
@@ -5175,12 +5177,17 @@ ira (FILE *f)
ira_conflicts_p = optimize > 0;
+ /* Determine the number of pseudos actually requiring coloring. */
+ for (i = FIRST_PSEUDO_REGISTER; i < DF_REG_SIZE (df); i++)
+ num_used_regs += !!(DF_REG_USE_COUNT (i) + DF_REG_DEF_COUNT (i));
+
/* If there are too many pseudos and/or basic blocks (e.g. 10K
pseudos and 10K blocks or 100K pseudos and 1K blocks), we will
use simplified and faster algorithms in LRA. */
lra_simple_p
= (ira_use_lra_p
- && max_reg_num () >= (1 << 26) / last_basic_block_for_fn (cfun));
+ && num_used_regs >= (1 << 26) / last_basic_block_for_fn (cfun));
+
if (lra_simple_p)
{
/* It permits to skip live range splitting in LRA. */