[Bug tree-optimization/79034] [6 Regression] error: missing PHI def in verify_gimple_in_cfg
rguenth at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Jan 10 10:05:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79034
--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
The issue is the degenerate PHI that doesn't appear on trunk (we're lucky).
Thus
/* We don't want to handle PHIs. */
if (EDGE_COUNT (join_tgt_in_edge_from_call->dest->preds) > 1)
join_tgt_bb = split_edge (join_tgt_in_edge_from_call);
doesn't catch that. There's the slight complication that virtual PHIs are ok
(we rewrite those). So the easiest thing is to propagate them out.
Index: gcc/tree-call-cdce.c
===================================================================
--- gcc/tree-call-cdce.c (revision 244260)
+++ gcc/tree-call-cdce.c (working copy)
@@ -805,7 +805,18 @@ shrink_wrap_one_built_in_call_with_conds
if (EDGE_COUNT (join_tgt_in_edge_from_call->dest->preds) > 1)
join_tgt_bb = split_edge (join_tgt_in_edge_from_call);
else
- join_tgt_bb = join_tgt_in_edge_from_call->dest;
+ {
+ join_tgt_bb = join_tgt_in_edge_from_call->dest;
+ /* We may have degenerate PHIs in the destination. Propagate
+ those out. */
+ for (gphi_iterator i = gsi_start_phis (join_tgt_bb); !gsi_end_p (i);)
+ {
+ gphi *phi = i.phi ();
+ replace_uses_by (gimple_phi_result (phi),
+ gimple_phi_arg_def (phi, 0));
+ remove_phi_node (&i, true);
+ }
+ }
}
else
{
More information about the Gcc-bugs
mailing list