This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug debug/43478] Missing DW_AT_location for a variable



------- Comment #1 from jakub at gcc dot gnu dot org  2010-03-22 19:16 -------
Several issues:
1) reassoc changes:
  [pr43478.c : 6:9] D.2722_1 = h ();
  [pr43478.c : 6:5] x_2 = D.2722_1 * 2;
  [pr43478.c : 6:5] # DEBUG x => x_2
  [pr43478.c : 7:9] D.2723_3 = h ();
  [pr43478.c : 7:5] y_4 = D.2723_3 * 2;
  [pr43478.c : 7:5] # DEBUG y => y_4
  [pr43478.c : 8:3] D.2724_5 = x_2 + y_4;
  return D.2724_5;
into
  [pr43478.c : 6:9] D.2722_1 = h ();
  [pr43478.c : 6:5] # DEBUG x => [pr43478.c : 6] D.2722_1 * 2
  [pr43478.c : 7:9] D.2723_3 = h ();
  D.2728_2 = D.2723_3 + D.2722_1;
  D.2728_4 = D.2728_2 * 2;
  [pr43478.c : 7:5] # DEBUG y => [pr43478.c : 7] D.2723_3 * 2
  [pr43478.c : 8:3] D.2724_5 = D.2728_4;
  return D.2724_5;
Perhaps it would be helpful if the DEBUG stmt got moved first in this case if
it in the end only references SSA names from before the statements.
2) during fwprop1, the well known DF dropping DEBUG_INSNS referencing DEAD
stmts
triggers:
(insn 9 8 10 2 pr43478.c:7 (set (reg:SI 60 [ D.2723 ])
        (reg:SI 0 ax)) 47 {*movsi_1} (nil))

(insn 10 9 11 2 pr43478.c:7 (parallel [
            (set (reg:SI 59 [ D.2728 ])
                (plus:SI (reg:SI 60 [ D.2723 ])
                    (reg:SI 58 [ D.2722 ])))
            (clobber (reg:CC 17 flags))
        ]) 251 {*addsi_1} (nil))

(debug_insn 11 10 12 2 pr43478.c:7 (var_location:SI y (mult:SI (reg:SI 60 [
D.2723 ])
        (const_int 2 [0x2]))) -1 (nil))
becomes:
(insn 9 8 10 2 pr43478.c:7 (set (reg:SI 60 [ D.2723 ])
        (reg:SI 0 ax)) 47 {*movsi_1} (expr_list:REG_DEAD (reg:SI 0 ax)
        (nil)))

(insn 10 9 11 2 pr43478.c:7 (parallel [
            (set (reg:SI 59 [ D.2728 ])
                (plus:SI (reg:SI 60 [ D.2723 ])
                    (reg:SI 58 [ D.2722 ])))
            (clobber (reg:CC 17 flags))
        ]) 251 {*addsi_1} (expr_list:REG_DEAD (reg:SI 60 [ D.2723 ])
        (expr_list:REG_DEAD (reg:SI 58 [ D.2722 ])
            (expr_list:REG_UNUSED (reg:CC 17 flags)
                (nil)))))

(debug_insn 11 10 12 2 pr43478.c:7 (var_location:SI y (clobber (const_int 0
[0x0]))) -1 (nil))
because reg:SI 60 is REG_DEAD in the insn before it.  In this case we even
can't
rematerialize it as (mult:SI (minus:SI (reg:SI 59) (reg:SI 58)) (const_int 2))
(while plus is reversible operation, both pseudos 60 and 58 are REG_DEAD in the
previous insn).
3) even if we handle this all the way through to var-tracking, while in theory
we can express it on the addition insn, the variable value is irrevocably lost
on the shl $1, %eax insn.


-- 


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]