https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65779

--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Alan Modra from comment #4)
> Created attachment 35342 [details]
> prototype patch
> 
> This seems to cure the testcase.  I haven't bootstrapped it, and it probably
> isn't ideal since I haven't poked at debug insns a lot..
> Still, it points out where the problem is, in move_insn_for_shrink_wrap.

Can't you use DF infrastructure for that (before actually moving the insn)?
I think pro_and_epilogue pass doesn't compute DF_DU_CHAINs, but perhaps
something along the lines of DCE reset_unmarked_insns_debug_uses?
I.e. not perform it at all if !MAY_HAVE_DEBUG_INSNS, and use DF infrastructure
to find out if the debug insn references the register.  Of course, unlike DCE,
we aren't looking at debug instructions referencing unmarked insns, but debug
instructions referencing a particular hard register.  Note that
live_edge_for_reg is called multiple times and thus could move across more than
one basic block, so perhaps you'd need to remember the sequence of basic blocks
to scan during the
  /* At this point we are committed to moving INSN, but let's try to
     move it as far as we can.  */
loop.

Reply via email to