> 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. * tree-ssa-dce.cc (find_debug_expr_decl): New callback. (mark_stmt_if_obviously_necessary): Add DECLS parameters. : 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