------- Comment #11 from aoliva at gcc dot gnu dot org 2009-09-15 04:17 ------- Referencing plain variable names in debug stmts is probably not a good idea, I think it's too fragile. However, arranging for SSA defs that would have been propagated into debug stmts to be instead replaced with other debug stmts that bind to temps appears to be pretty easy to introduce. I'm (slowly, on the road) working on a patch to do just that.
So instead of # DEBUG i2 => ((i_1(D) + i_1(D)) + (i_1(D) + i_1(D)) we'll have # DEBUG DT.0 => (i_1(D) + i_1(D)) # DEBUG i2 => DT.0 + DT.0 these debug temps, if introduced as a different kind of declaration, with its own uid counter, won't interfere with regular declarations UIDs, which affect codegen. They can be expanded and linked to a new RTL form, that links back to the tree form, so that the new RTL form can be used in RTL expressions, while the VAR_LOCATION still holds the tree form, and then var-tracking generates a value for the RTL expression, and voila :-) The only case of loss of debug info I can think of is if the block containing a debug bind stmt for one of these temps is removed, but a subsequent block that would require the debug bind stmt isn't. I don't think this should happen in general (it would be non-SSA), but I haven't quite thought it through. We'll see... -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41343