On 2/10/23 03:12, Richard Biener via Gcc-patches wrote:
The following fixes a latent issue when we mark control edges but
end up with marking a block with no stmts necessary.  In this case
we fail to mark dependent control edges of that block.

Bootstrapped and tested on x86_64-unknown-linux-gnu.

Does this look OK?

Thanks,
Richard.

        PR tree-optimization/106722
        * tree-ssa-dce.cc (mark_last_stmt_necessary): Return
        whether we marked a stmt.
        (mark_control_dependent_edges_necessary): When
        mark_last_stmt_necessary didn't mark any stmt make sure
        to mark its control dependent edges.
        (propagate_necessity): Likewise.

        * gcc.dg/torture/pr108737.c: New testcase.

diff --git a/gcc/tree-ssa-dce.cc b/gcc/tree-ssa-dce.cc
index b2fe9f4f55e..21b3294fc86 100644
--- a/gcc/tree-ssa-dce.cc
+++ b/gcc/tree-ssa-dce.cc
@@ -327,17 +327,23 @@ mark_stmt_if_obviously_necessary (gimple *stmt, bool 
aggressive)
/* Mark the last statement of BB as necessary. */ -static void
+static bool
Function comment probably needs an update for the new return value.

OK with that fix.

jeff

Reply via email to