https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66614
--- Comment #2 from Bernd Edlinger <bernd.edlinger at hotmail dot de> --- this is what I understand from lra in my own words: lra () consists of a sequence of for (;;) { ... lra_eliminate (false, false); /* Do inheritance only for regular algorithms. */ if (! lra_simple_p) { if (flag_ipa_ra) { if (live_p) lra_clear_live_ranges (); /* As a side-effect of lra_create_live_ranges, we calculate actual_call_used_reg_set, which is needed during lra_inheritance. */ lra_create_live_ranges (true, true); live_p = true; } lra_inheritance (); } if (live_p) lra_clear_live_ranges (); ... } and it is finally fixated by lra_eliminate (true, false); which actually replaces the base register, but keeps the offsets as they are the RTL transformations are done by lra_eliminate_regs_1 (): first it is called with subst_p=false, update_p=false, full_p=true, this replaces the offset relative to from_rtx to to_rtx, but keeps the previous base register. then it is repeatedly called with subst_p=false, update_p=true, full_p=false, which adds some minor corrections to the offset, and again keeps the to be eliminated base register. finally it is called with subst_p=true, update_p=false, full_p=false, this time only the base register is replaced but the offsets are already relative to the target base register. lra_create_live_ranges calls process_bb_lives repeatedly which uses this as a pre-condition of a dead insn which and can be eliminated: if (dead_insn_p && set != NULL_RTX && REG_P (SET_DEST (set)) && REGNO (SET_DEST (set)) >= FIRST_PSEUDO_REGISTER && find_reg_note (curr_insn, REG_EH_REGION, NULL_RTX) == NULL_RTX && ! may_trap_p (PATTERN (curr_insn)) /* Don't do premature remove of pic offset pseudo as we can start to use it after some reload generation. */ && (pic_offset_table_rtx == NULL_RTX || pic_offset_table_rtx != SET_DEST (set))) now may_trap_p sees the offsets which are not consistent with the base.