On 10/21/18 2:07 AM, Alexandre Oliva wrote: > As auto_inc_dec pass combines incs and mems from different insns, it > often causes regs to temporarily hold a value different from the one > it would before the transformation. Debug insns within that range > would therefore end up binding to the wrong expression after the > transformation. > > This patch adjusts debug binds in the affected range. > > Regstrapped on x86_64-, i686-, ppc64-, ppc64el-, and aarch64-linux-gnu. > Ok to install? > > for gcc/ChangeLog > > * auto-inc-dec.c: Include valtrack.h. Improve comments. > (reg_next_debug_use): New. > (attempt_change): Propagate adjusted expression into affected > debug insns. > (merge_in_block): Track uses in debug insns. > (pass_inc_dec::execute): Allocate and release > reg_next_debug_use. OK.
> --- > gcc/auto-inc-dec.c | 128 > +++++++++++++++++++++++++++++++++++++++++++++++++++- > 1 file changed, 125 insertions(+), 3 deletions(-) > > diff --git a/gcc/auto-inc-dec.c b/gcc/auto-inc-dec.c > index e6dc1c30d716..064b8afd4ff9 100644 > --- a/gcc/auto-inc-dec.c > +++ b/gcc/auto-inc-dec.c > @@ -509,27 +529,83 @@ attempt_change (rtx new_addr, rtx inc_reg) > gcc_assert (mov_insn); > emit_insn_before (mov_insn, inc_insn.insn); > regno = REGNO (inc_insn.reg0); > + /* ??? Could REGNO possibly be used in MEM_INSN other than in > + the MEM address, and still die there, so that move_dead_notes > + would incorrectly move the note? */ Perhaps some kind of weird parallel where there's a memory operation of some sort and some unrelated ALU where REGNO is a source operand in the ALU and dies? I'm not immediately aware of any such insn on any target, but I'm far from an expert in all the odd things ISAs do :-) Jeff