From: Jeff Law Date: Wed, 21 Nov 2018 13:37:11 +0000 (-0700) Subject: re PR tree-optimization/88069 (ICE in check_loop_closed_ssa_def, at tree-ssa-loop... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0f9657f3775f4075d1c5e2067964630e18c4e2c9;p=gcc.git re PR tree-optimization/88069 (ICE in check_loop_closed_ssa_def, at tree-ssa-loop-manip.c:709) 2018-11-20 Jeff Law PR tree-optimization/88069 * tree-ssa-dom.c (record_equivalences_from_phis): Propagate away degenerate virtual PHIs. From-SVN: r266343 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 692f3fb1961..967967641f3 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2018-11-20 Jeff Law + + PR tree-optimization/88069 + * tree-ssa-dom.c (record_equivalences_from_phis): Propagate away + degenerate virtual PHIs. + 2018-11-21 H.J. Lu PR target/87317 diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c index 7787da8b237..ce840488403 100644 --- a/gcc/tree-ssa-dom.c +++ b/gcc/tree-ssa-dom.c @@ -1106,10 +1106,13 @@ record_equivalences_from_phis (basic_block bb) { gphi_iterator gsi; - for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi)) + for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); ) { gphi *phi = gsi.phi (); + /* We might eliminate the PHI, so advance GSI now. */ + gsi_next (&gsi); + tree lhs = gimple_phi_result (phi); tree rhs = NULL; size_t i; @@ -1159,9 +1162,26 @@ record_equivalences_from_phis (basic_block bb) this, since this is a true assignment and not an equivalence inferred from a comparison. All uses of this ssa name are dominated by this assignment, so unwinding just costs time and space. */ - if (i == gimple_phi_num_args (phi) - && may_propagate_copy (lhs, rhs)) - set_ssa_name_value (lhs, rhs); + if (i == gimple_phi_num_args (phi)) + { + if (may_propagate_copy (lhs, rhs)) + set_ssa_name_value (lhs, rhs); + else if (virtual_operand_p (lhs)) + { + gimple *use_stmt; + imm_use_iterator iter; + use_operand_p use_p; + /* For virtual operands we have to propagate into all uses as + otherwise we will create overlapping life-ranges. */ + FOR_EACH_IMM_USE_STMT (use_stmt, iter, lhs) + FOR_EACH_IMM_USE_ON_STMT (use_p, iter) + SET_USE (use_p, rhs); + if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (lhs)) + SSA_NAME_OCCURS_IN_ABNORMAL_PHI (rhs) = 1; + gimple_stmt_iterator tmp_gsi = gsi_for_stmt (phi); + remove_phi_node (&tmp_gsi, true); + } + } } }