]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR rtl-optimization/88751 (Performance regression reload vs lra)
authorAndreas Krebbel <krebbel@linux.ibm.com>
Fri, 20 Sep 2019 12:18:26 +0000 (12:18 +0000)
committerAndreas Krebbel <krebbel@gcc.gnu.org>
Fri, 20 Sep 2019 12:18:26 +0000 (12:18 +0000)
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.

From-SVN: r276000

gcc/ChangeLog
gcc/ira.c

index f1f923a06ddced7825a1d7d101ef0dc55964fa65..628a5fe3312e0364040aa1f584e6e47394aba90e 100644 (file)
@@ -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-20  Kito Cheng  <kito.cheng@sifive.com>
 
        Backport from mainline
index fd481d6e0e2f7a8e4c8f11573d6b94238ee051f0..b330f2a287bac0387ca054f2592bc496b0b98a4f 100644 (file)
--- a/gcc/ira.c
+++ b/gcc/ira.c
@@ -5198,6 +5198,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 ();
 
@@ -5213,12 +5215,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.  */