https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83327
Tom de Vries <vries at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #42817|0 |1 is obsolete| | --- Comment #3 from Tom de Vries <vries at gcc dot gnu.org> --- Created attachment 42850 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=42850&action=edit Tentative trunk patch I've re-enabled i86_spill_class on trunk, added a printf when the optimization is effective and build gcc on my laptop (with kaby lake cpu) with march=haswell enabled by default. I investigated the trigger: ... Spill r87 into hr24 for fn __eqtf2 in libgcc/soft-fp/eqtf2.c ... and observed that the life-range r87 is stretched over different basic blocks. Then I added a "lra_create_live_ranges (lra_reg_spill_p, true)" after lra_spill to force the live range analysis to run. I observed that the live range analysis was only run once, meaning that the hr24 usage is not propagated, which is AFAIU a reproduction of the root cause of this PR. I added code to the end of process_bb_lives to trigger the second live range analysis: ... @@ -1049,6 +1049,24 @@ 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); ... and ran into the assert at the end of lra_create_live_ranges because although the register is noted as changing liveness, it's still not propagated, and we don't reach fixed point. I then added fixes in make_hard_regno_{born,dead} in the same style as the fix for PR82353, and that allowed the live info to be propagated.