[PATCH 3/9] dce: Don't dead-code delete separately wrapped restores

Jeff Law law@redhat.com
Fri Sep 9 16:39:00 GMT 2016


On 09/09/2016 09:51 AM, Segher Boessenkool wrote:
> On Thu, Sep 08, 2016 at 11:50:56AM -0600, Jeff Law wrote:
>> On 07/31/2016 07:42 PM, Segher Boessenkool wrote:
>>> Deleting restores (before a noreturn) that are dead confuses dwarf2cfi.
>>>
>>> 2016-06-07  Segher Boessenkool  <segher@kernel.crashing.org>
>>>
>>> 	* dce.c (delete_unmarked_insns): Don't delete instructions with
>>> 	a REG_CFA_RESTORE note.
>> I don't really understand this one.  Why is the restore marked dead and
>> why doesn't that happen for normal epilogues?  Something wonky seems to
>> be going on here.
>
> Because it's not behind a NOTE_INSN_EPILOGUE_BEGIN it is not treated
> specially by DCE, like insns in "normal" epilogues are.
Ohhhhh!  While I don't see the special handling of things after 
NOTE_INSN_EPILOGUE_BEG, I do see this in df-scan.c:

   if (targetm.have_epilogue () && epilogue_completed)
     {
       /* Mark all call-saved registers that we actually used.  */
       for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
         if (df_regs_ever_live_p (i) && !LOCAL_REGNO (i)
             && !TEST_HARD_REG_BIT (regs_invalidated_by_call, i))
           bitmap_set_bit (exit_block_uses, i);
     }

Which then presumably gets used elsewhere when solving problems.

I wonder if we need some kind of similar mechanism to make those 
registers appear to be live at the component epilogues.

Jeff




More information about the Gcc-patches mailing list