On Wed, Apr 26, 2023 at 11:31 AM Eric Botcazou <botca...@adacore.com> wrote:
>
> > probably also helps PR109612 and the other similar PR referenced therein.
>
> Here's a more aggressive patch in this area, but it regresses guality tests,
> for example:
>
> +FAIL: gcc.dg/guality/ipa-sra-1.c   -O2  -DPREVENT_OPTIMIZATION  line 27 k ==
> 3
> +FAIL: gcc.dg/guality/ipa-sra-1.c   -O3 -g  -DPREVENT_OPTIMIZATION  line 27 k
> == 3
> +FAIL: gcc.dg/guality/ipa-sra-1.c   -Os  -DPREVENT_OPTIMIZATION  line 27 k ==
> 3
>
> eric@fomalhaut:~/build/gcc/native> diff -u ipa-sra-1.c.254t.optimized.0 ipa-
> sra-1.c.254t.optimized
> --- ipa-sra-1.c.254t.optimized.0        2023-04-26 11:12:07.806357325 +0200
> +++ ipa-sra-1.c.254t.optimized  2023-04-26 11:24:08.632874257 +0200
> @@ -101,7 +101,6 @@
>    # DEBUG k => k_5
>    # DEBUG BEGIN_STMT
>    _1 = get_val1 ();
> -  # DEBUG D#6 => k_5
>    r_8 = foo.isra (_1);
>    # DEBUG r => r_8
>    # DEBUG BEGIN_STMT
>
> and I don't understand why yet.

interesting.  So that removes unmentioned debug temporaries?  I think
remove_unused_locals does something to debug stmts as well
(but from a quick look cannot decipher what it actually does).

On the RTL level delete_trivially_dead_insns does wipe some (redundant)
debug_insns, there's no exact match to that on the GIMPLE side either.

I'm not sure if DCE is a good place to do this.

>
>         * tree-ssa-dce.cc (find_debug_expr_decl): New callback.
>         (mark_stmt_if_obviously_necessary): Add DECLS parameters.
>         <GIMPLE_DEBUG>: Call find_debug_expr_decl on the value of
>         DEBUG_BIND statements and record the results in DECLS.
>         (find_obviously_necessary_stmts): If DEBUG_BIND statements may be
>         present, get rid of those setting an unnecessary DEBUG_EXPR_DECL.
>
> --
> Eric Botcazou

Reply via email to