> @@ -1272,7 +1275,7 @@ maybe_optimize_arith_overflow (gimple_stmt_iterator
> *gsi,
> contributes nothing to the program, and can be deleted. */
>
> static bool
> -eliminate_unnecessary_stmts (void)
> +eliminate_unnecessary_stmts (bool aggressive)
> {
> bool something_changed = false;
> basic_block bb;
> @@ -1366,7 +1369,9 @@ eliminate_unnecessary_stmts (void)
> break;
> }
> }
> - if (!dead)
> + if (!dead
> + && (!aggressive
> + || bitmap_bit_p (visited_control_parents, bb->index)))
It seems to me that it may be worth to consider case where
visited_control_parents is 0 while all basic blocks in the CD relation
are live for different reasons. I suppose this can happen in more
complex CFGs when the other arms of conditionals are live...
Honza
> {
> bitmap_clear (debug_seen);
> continue;
> @@ -1876,7 +1881,7 @@ perform_tree_ssa_dce (bool aggressive)
> propagate_necessity (aggressive);
> BITMAP_FREE (visited);
>
> - something_changed |= eliminate_unnecessary_stmts ();
> + something_changed |= eliminate_unnecessary_stmts (aggressive);
> something_changed |= cfg_altered;
>
> /* We do not update postdominators, so free them unconditionally. */
> --
> 2.34.1