[backport proposed 4.8/trunk fix for M68K PR52573 ] Date: Wed, 11 Jul 2012 23:31:07 +0200 From: Bernd Schmidt Subject: Re: regrename creates invalid insn List-Archive: On 03/26/2012 06:03 PM, Andreas Schwab wrote: > Bernd Schmidt writes: > >> Does 4.7 still have the failure at all? > > Yes, see PR52573. Well, I still think having both REG_DEAD and REG_UNUSED for the same reg is bogus, but fixing that causes trouble in reg-stack. It seems the path of least resistance is to just cope with the situation in regrename. The following seems to cure the problem with a 4.7 m68k cross. Also bootstrapped and tested with -frename-registers enabled at -O2 on x86_64-linux. Ok everywhere? Bernd gcc/ PR rtl-optimization/52573 * regrename.c (build_def_use): Ignore REG_DEAD notes if there is a REG_UNUSED for the same register. --- gcc-4.6.3/gcc/regrename.c.~1~ 2011-01-02 18:28:24.000000000 +0100 +++ gcc-4.6.3/gcc/regrename.c 2012-07-14 15:59:06.000000000 +0200 @@ -1328,7 +1328,8 @@ build_def_use (basic_block bb) /* Step 4: Close chains for registers that die here. */ for (note = REG_NOTES (insn); note; note = XEXP (note, 1)) - if (REG_NOTE_KIND (note) == REG_DEAD) + if (REG_NOTE_KIND (note) == REG_DEAD + && !find_regno_note (insn, REG_UNUSED, REGNO (XEXP (note, 0)))) { remove_from_hard_reg_set (&live_hard_regs, GET_MODE (XEXP (note, 0)),