On Thu, Mar 24, 2016 at 09:20:36AM +1030, Alan Modra wrote:
> On Wed, Mar 23, 2016 at 01:03:18AM +0100, Bernd Schmidt wrote:
> > >@@ -3536,7 +3557,8 @@ update_equiv_regs (void)
> > > {
> > > /* Note that the statement below does not affect the priority
> > >in local-alloc! */
> > >-REG_LIVE_LENGTH (regno) *= 2;
> > >+if (note)
> > >+ REG_LIVE_LENGTH (regno) *= 2;
> >
> > That's a very suspicious comment. It would be worth testing whether
> > REG_LIVE_LENGTH has any effect on our current register allocation at all,
> > and remove this code if not.
>
> Yes, REG_LIVE_LENGTH is used in just one place in the whole of gcc,
> and that's the test in update_equiv_regs just above the code you
> quote.
> /* Don't mess with things live during setjmp. */
> if (REG_LIVE_LENGTH (regno) >= 0 && optimize)
>
> That could be replaced with
> if (optimize && !bitmap_bit_p (setjmp_crosses, regno))
> and outside the loop
> bitmap setjmp_crosses = regstat_get_setjmp_crosses ();
>
> For now, I've removed the REG_LIVE_LENGTH adjustment from patch 7/7.
> I'll also prepare a patch to delete REG_LIVE_LENGTH everywhere.
Like this. Bootstrapped and regression tested x86_64-linux.
OK for stage1?
* regs.h (struct reg_info_t): Delete live_length.
(REG_LIVE_LENGTH): Delete macro.
* regstat.c (regstat_bb_compute_ri): Delete artificial_uses,
local_live, local_processed and local_live_last_luid params.
Replace bb_index param with bb. Don't set REG_LIVE_LENGTH.
Formatting fixes.
(regstat_compute_ri): Adjust for above. Don't set
REG_LIVE_LENGTH.
(dump_reg_info): Don't print live length.
* ira.c (update_equiv_regs): Replace test of REG_LIVE_LENGTH
with test of setjmp_crosses. Don't set REG_LIVE_LENGTH.
Localize loop_depth var.
diff --git a/gcc/ira.c b/gcc/ira.c
index cab8dc1..3173276 100644
--- a/gcc/ira.c
+++ b/gcc/ira.c
@@ -3315,7 +3315,6 @@ update_equiv_regs (void)
{
rtx_insn *insn;
basic_block bb;
- int loop_depth;
/* Scan insns and set pdx_subregs if the reg is used in a
paradoxical subreg. Don't set such reg equivalent to a mem,
@@ -3329,9 +3328,10 @@ update_equiv_regs (void)
/* Scan the insns and find which registers have equivalences. Do this
in a separate scan of the insns because (due to -fcse-follow-jumps)
a register can be set below its use. */
+ bitmap setjmp_crosses = regstat_get_setjmp_crosses ();
FOR_EACH_BB_FN (bb, cfun)
{
- loop_depth = bb_loop_depth (bb);
+ int loop_depth = bb_loop_depth (bb);
for (insn = BB_HEAD (bb);
insn != NEXT_INSN (BB_END (bb));
@@ -3553,12 +3553,8 @@ update_equiv_regs (void)
reg_equiv[regno].loop_depth = (short) loop_depth;
/* Don't mess with things live during setjmp. */
- if (REG_LIVE_LENGTH (regno) >= 0 && optimize)
+ if (optimize && !bitmap_bit_p (setjmp_crosses, regno))
{
- /* Note that the statement below does not affect the priority
-in local-alloc! */
- REG_LIVE_LENGTH (regno) *= 2;
-
/* If the register is referenced exactly twice, meaning it is
set once and used once, indicate that the reference may be
replaced by the equivalence we computed above. Do this
@@ -3744,7 +3740,6 @@ combine_and_move_insns (void)
REG_N_CALLS_CROSSED (regno) = 0;
REG_FREQ_CALLS_CROSSED (regno) = 0;
REG_N_THROWING_CALLS_CROSSED (regno) = 0;
- REG_LIVE_LENGTH (regno) = 2;
if (use_insn == BB_HEAD (use_bb))
BB_HEAD (use_bb) = new_insn;
diff --git a/gcc/regs.h b/gcc/regs.h
index 6f992bd..244250d 100644
--- a/gcc/regs.h
+++ b/gcc/regs.h
@@ -105,7 +105,6 @@ struct reg_info_t
{
int freq;/* # estimated frequency (REG n) is used or set
*/
int deaths; /* # of times (REG n) dies */
- int live_length; /* # of instructions (REG n) is live */
int calls_crossed; /* # of calls (REG n) is live across */
int freq_calls_crossed; /* # estimated frequency (REG n) crosses call */
int throw_calls_crossed; /* # of calls that may throw (REG n) is live
across */
@@ -170,20 +169,6 @@ extern size_t reg_info_p_size;
#define REG_N_THROWING_CALLS_CROSSED(N) (reg_info_p[N].throw_calls_crossed)
-/* Total number of instructions at which (REG n) is live.
-
- This is set in regstat.c whenever register info is requested and
- remains valid for the rest of the compilation of the function; it is
- used to control register allocation. The larger this is, the less
- priority (REG n) gets for allocation in a hard register (in IRA in
- priority-coloring mode).
-
- Negative values are special: -1 is used to mark a pseudo r