PR debug/41229 [VTA] ssa-update former VUSEs-to-be in debug stmts
Richard Guenther
richard.guenther@gmail.com
Fri Sep 4 09:39:00 GMT 2009
On Thu, Sep 3, 2009 at 10:47 PM, Alexandre Oliva<aoliva@redhat.com> wrote:
> We don't carry VOPs in debug stmts. As a result, when an addressable
> variable (for which we'd have set a VUSE in a non-debug stmt) becomes
> non-addressable because of optimizations, we may fail to rename the
> occurrences of the variable in debug stmts, because there won't be any
> USEs to be seen.
>
> This patch checks for variables that need renaming in the bound
> expressions in debug stmts and, if any are found, it updates the debug
> stmt's operands, so that the reference becomes a regular USE, that will
> be updated.
>
> I don't like the walking much, but I don't see much of an alternative
> short of bringing VOPs into debug stmts, a can of worms I'd rather not
> open. Perhaps an alternative would be to count even addressable DECLs
> as regular USEs in debug stmts, but I guess this might require a lot of
> special-casing elsewhere. Perhaps creating a new kind of use for this
> purpose would be useful? Thoughts?
What does this have to do with VOPs? On the trunk we'd have
# .MEM_2 = VUSE <.MEM_1(D)>
i = 1;
j_3 = i;
# DEBUG j => j_3
and now we DCE j_3 and get
# .MEM_2 = VUSE <.MEM_1(D)>
i = 1;
# DEBUG j => i
IIRC, right? Now suppose i is no longer addressable and we mark i
for rewriting into SSA form. That's your scenario, no?
I don't see how VOPs for the debug stmts would help at all here.
The key is that execute_update_addresses_taken updates all statements
that have uses of the symbol and the operand scanner adds the bare
symbols as regular uses. Thus the proper place for the fix is in
execute_update_addresses_taken, the final loop conditional on
update_vops (what a bad name now ...) that updates all stmts
referencing memory (overkill of course). Just add to the overkill and
update all debug stmts unconditionally.
> Meanwhile, here's a patch that I'm testing, that fixes this bug.
A patch that adds
if (gimple_debug_bind_p (stmt))
update_stmt (stmt);
with a comment in the referenced place is ok.
Thanks,
Richard.
>
>
> --
> Alexandre Oliva, freedom fighter http://FSFLA.org/~lxoliva/
> You must be the change you wish to see in the world. -- Gandhi
> Be Free! -- http://FSFLA.org/ FSF Latin America board member
> Free Software Evangelist Red Hat Brazil Compiler Engineer
>
>
More information about the Gcc-patches
mailing list