https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90273

--- Comment #13 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #9)
> Created attachment 46257 [details]
> more aggressive variant
> 
> More aggressive variant using a bitmap, simply keeping the last, does for
> example
> 
> @@ -243,7 +237,6 @@
>    <bb 5> [local count: 43794188]:
>    # DEBUG BEGIN_STMT
>    i_28 = i_35 + 1;
> -  # DEBUG i => i_28
>    # DEBUG d => 1
>    # DEBUG i => i_28
> 
> note if there are debug temps those are still not DCEd even if not used.
> In theory they should always have debug temp defs and uses in the same
> BB so the backward walk could gather local uses.  But that needs more
> experiments / verification.

As noted this one likely isn't safe considering

 # DEBUG D#1 => 123;
 # DEBUG a => D#1;
 # DEBUG D#1 => 234;
 # DEBUG b => D#1;

where we'd remove the # DEBUG D#1 => 123; stmt.  It has been said the
situation can only occur with DEBUG_EXPR_DECL thus excempting those
would work.  That is, replacing D#1 with say 'c' won't ever happen
(non-DEBUG_EXPR_DECL decls on the RHS, there just appear SSA names,
invariants or DEBUG_EXPR_DECLs).

With not DCEing DEBUG_EXPR_DECL binds on the testcase we go from

> wc -l Unified_cpp_dom_events0-8.ii.046t.release_ssa
163546 Unified_cpp_dom_events0-8.ii.046t.release_ssa

to

> wc -l Unified_cpp_dom_events0-8.ii.046t.release_ssa
163626 Unified_cpp_dom_events0-8.ii.046t.release_ssa

Reply via email to