> One of the issues was that DCE removed an insn that set a REG in a
> certain mode, without adjusting a debug use of that REG.  This was in
> libstdc++, but I failed to take note of the affected file.  DF later
> attached that debug use to another SET to the same REG in a different,
> incompatible mode.  When that one was found to be dead by DF, we ended
> up ICEing as we attempted to emit the invalid SUBREGs.
>
> I reused some of the infrastructure to propagate dead DEFs into debug
> uses in DF to get DCE to emit debug temps and adjust debug uses as well,
> fixing this issue.  While at that, I improved the handling of unused
> DEFs in DF, that previously resulted in loss of debug information, so as
> to retain it as much as possible.

Why can't the problem be addressed purely within DF?  Starting to spill the DF 
logic to individual RTL passes doesn't look very appealing to me.

> This is the patch I ended up with.  Regstrapped on x86_64-linux-gnu and
> i686-linux-gnu.  Ok to install?

OK for the usual debug insn bookkeeping, i.e.

        * dce.c (reset_unmarked_insns_debug_uses): New.
        (delete_unmarked_insns): Skip debug insns.
        (prescan_insns_for_dce): Likewise.
        (rest_of_handle_ud_dce): Propagate debug uses.
        * reg-stack.c (subst_stack_regs_in_debug_insn): Signal when no
        active reg can be found.
        (subst_all_stack_regs_in_debug_insn): New.  Reset debug insn then.
        (convert_regs_1): Use it.

The rest needs further discussing IMO.

-- 
Eric Botcazou

Reply via email to