aboutsummaryrefslogtreecommitdiff
path: root/gcc/lra-lives.c
diff options
context:
space:
mode:
authorTom de Vries <tom@codesourcery.com>2018-03-01 05:51:08 +0000
committerTom de Vries <vries@gcc.gnu.org>2018-03-01 05:51:08 +0000
commit54178a01107b911813609693dd8d91968ac06819 (patch)
treed07c5b1a1c94714f4b24f7a5d327eefc320c6bf7 /gcc/lra-lives.c
parent7540ea866ad77094e6f77023558378ce9b196fd5 (diff)
downloadgcc-54178a01107b911813609693dd8d91968ac06819.zip
gcc-54178a01107b911813609693dd8d91968ac06819.tar.gz
gcc-54178a01107b911813609693dd8d91968ac06819.tar.bz2
Fix liveness analysis in lra for spilled-into hard regs
2018-03-01 Tom de Vries <tom@codesourcery.com> PR rtl-optimization/83327 * lra-int.h (hard_regs_spilled_into): Declare. * lra.c (hard_regs_spilled_into): Define. (init_reg_info): Init hard_regs_spilled_into. * lra-spills.c (assign_spill_hard_regs): Update hard_regs_spilled_into. * lra-lives.c (make_hard_regno_born, make_hard_regno_dead) (process_bb_lives): Handle hard_regs_spilled_into. (lra_create_live_ranges_1): Before doing liveness propagation, clear regs in all_hard_regs_bitmap if set in hard_regs_spilled_into. From-SVN: r258093
Diffstat (limited to 'gcc/lra-lives.c')
-rw-r--r--gcc/lra-lives.c28
1 files changed, 26 insertions, 2 deletions
diff --git a/gcc/lra-lives.c b/gcc/lra-lives.c
index ddc0a9b..588bc09 100644
--- a/gcc/lra-lives.c
+++ b/gcc/lra-lives.c
@@ -246,7 +246,7 @@ make_hard_regno_born (int regno, bool check_pic_pseudo_p ATTRIBUTE_UNUSED)
|| i != REGNO (pic_offset_table_rtx))
#endif
SET_HARD_REG_BIT (lra_reg_info[i].conflict_hard_regs, regno);
- if (fixed_regs[regno])
+ if (fixed_regs[regno] || TEST_HARD_REG_BIT (hard_regs_spilled_into, regno))
bitmap_set_bit (bb_gen_pseudos, regno);
}
@@ -260,7 +260,7 @@ make_hard_regno_dead (int regno)
return;
sparseset_set_bit (start_dying, regno);
CLEAR_HARD_REG_BIT (hard_regs_live, regno);
- if (fixed_regs[regno])
+ if (fixed_regs[regno] || TEST_HARD_REG_BIT (hard_regs_spilled_into, regno))
{
bitmap_clear_bit (bb_gen_pseudos, regno);
bitmap_set_bit (bb_killed_pseudos, regno);
@@ -1062,6 +1062,25 @@ process_bb_lives (basic_block bb, int &curr_point, bool dead_insn_p)
check_pseudos_live_through_calls (j, last_call_used_reg_set);
}
+ for (i = 0; i < FIRST_PSEUDO_REGISTER; ++i)
+ {
+ if (!TEST_HARD_REG_BIT (hard_regs_live, i))
+ continue;
+
+ if (!TEST_HARD_REG_BIT (hard_regs_spilled_into, i))
+ continue;
+
+ if (bitmap_bit_p (df_get_live_in (bb), i))
+ continue;
+
+ live_change_p = true;
+ if (lra_dump_file)
+ fprintf (lra_dump_file,
+ " hard reg r%d is added to live at bb%d start\n", i,
+ bb->index);
+ bitmap_set_bit (df_get_live_in (bb), i);
+ }
+
if (need_curr_point_incr)
next_program_point (curr_point, freq);
@@ -1331,6 +1350,11 @@ lra_create_live_ranges_1 (bool all_p, bool dead_insn_p)
}
/* As we did not change CFG since LRA start we can use
DF-infrastructure solver to solve live data flow problem. */
+ for (int i = 0; i < FIRST_PSEUDO_REGISTER; ++i)
+ {
+ if (TEST_HARD_REG_BIT (hard_regs_spilled_into, i))
+ bitmap_clear_bit (&all_hard_regs_bitmap, i);
+ }
df_simple_dataflow
(DF_BACKWARD, NULL, live_con_fun_0, live_con_fun_n,
live_trans_fun, &all_blocks,