diff mbox

[RFC,IRA] Initialize ira_use_lra_p early by moving the initialization into ira_init_once ().

Message ID 57E27333.5000808@foss.arm.com
State New
Headers show

Commit Message

Renlin Li Sept. 21, 2016, 11:46 a.m. UTC
Hi,

ira_use_lra_p is a global variable use in ira as well as 
backend_init_target ().
It's fine to be used in IRA as it's will be initialized at the beginning 
of ira pass.

However, early in backend_init_target (), this variable may not be 
initialized yet. There is a check in backend_init_target ():

'''
if (!ira_use_lra_p)
   init_reload ();
'''

In this case, init_reload () will always be called if ira_use_lra_p is 
not initialized.

ira_init_once () is a better place for the initialization.
It's called early in initialize_rtl (), just before
backend_init_target ().
And as the name suggests, it's called once to initialize function 
independent data structure.

aarch64-none-elf regression test Okay, x86-64-linux bootstrap Okay.

Regards,
Renlin

gcc/ChangeLog:

2016-09-21  Renlin Li  <renlin.li@arm.com>

	* ira.c (ira): Move ira_use_lra_p initialization code to ...
	(ira_init_once): Here.

Comments

Bernd Schmidt Sept. 21, 2016, 11:52 a.m. UTC | #1
On 09/21/2016 01:46 PM, Renlin Li wrote:
>     * ira.c (ira): Move ira_use_lra_p initialization code to ...
>     (ira_init_once): Here.

LGTM.


Bernd
diff mbox

Patch

diff --git a/gcc/ira.c b/gcc/ira.c
index f8a59e3..9e7ba52 100644
--- a/gcc/ira.c
+++ b/gcc/ira.c
@@ -1665,6 +1665,8 @@  ira_init_once (void)
 {
   ira_init_costs_once ();
   lra_init_once ();
+
+  ira_use_lra_p = targetm.lra_p ();
 }
 
 /* Free ira_max_register_move_cost, ira_may_move_in_cost and
@@ -5082,7 +5084,6 @@  ira (FILE *f)
 
   ira_conflicts_p = optimize > 0;
 
-  ira_use_lra_p = targetm.lra_p ();
   /* 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.  */