[Bug debug/41353] VTA missed-debug issues

jakub at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Wed Sep 16 11:49:00 GMT 2009



------- Comment #5 from jakub at gcc dot gnu dot org  2009-09-16 11:48 -------
Looking at the
int
foo (int i)
{
  asm volatile ("" : "+r" (i));
  int i1 = 2 * i;
  int i2 = 2 * i;
  int i3 = 2 * i;
  return i;
}
testcase now, here the problem is that cse1 pass sees:
(insn 7 6 8 2 d6.c:4 (set (reg/v:SI 59 [ i ])
        (reg:SI 60)) 47 {*movsi_1} (nil))
(pseudo 60 is the dest of the asm, pseudo 59 is the real variable) and replaces
all occurrences of pseudo 59 with pseudo 60 in the following insns, including
DEBUG_INSNs.  But, pseudo 60 doesn't have REG_EXPR set obviously.
In *.compgotos we have:
(debug_insn 8 6 9 2 d6.c:4 (var_location:SI i (reg:SI 0 ax [60])) -1 (nil))
(debug_insn 9 8 10 2 d6.c:5 (var_location:SI i1 (mult:SI (reg:SI 0 ax [60])
        (const_int 2 [0x2]))) -1 (nil))
(debug_insn 10 9 11 2 d6.c:6 (var_location:SI i2 (mult:SI (reg:SI 0 ax [60])
        (const_int 2 [0x2]))) -1 (nil))
(debug_insn 11 10 19 2 d6.c:7 (var_location:SI i3 (mult:SI (reg:SI 0 ax [60])
        (const_int 2 [0x2]))) -1 (nil))
(insn 19 11 24 2 d6.c:9 (use (reg/i:SI 0 ax)) -1 (nil))
So, we first have a MO_USE_NO_VAR, then MO_VAL_LOC saying i lives in %eax, then
MO_USE_NO_VAR for the occurrence of %eax in debug_insn 9, then MO_VAL_LOC
saying it lives in %eax * 2, etc.  But, each such MO_USE_NO_VAR will clobber
anything that lives in that register or depends on it.
I wonder if we shouldn't special case regs without REG_EXPR referenced from
DEBUG_INSN expressions.  Perhaps they could be ignored altogether or something.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41353



More information about the Gcc-bugs mailing list