This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/78224] [5/6/7 Regression] g++ ICE at -O2(-O1 on gcc6) and above in verify_loop_structure, at cfgloop.c:1646
- From: "rguenth at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 07 Nov 2016 13:50:57 +0000
- Subject: [Bug tree-optimization/78224] [5/6/7 Regression] g++ ICE at -O2(-O1 on gcc6) and above in verify_loop_structure, at cfgloop.c:1646
- Auto-submitted: auto-generated
- References: <bug-78224-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78224
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
Assignee|unassigned at gcc dot gnu.org |rguenth at gcc dot gnu.org
--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
On the branch this is call-cdce, probably on trunk as well. It wrecks loop
info
when the call is in the loop latch and we have an EH loop exit in this case:
/* Now find the join target bb -- split bi_call_bb if needed. */
if (stmt_ends_bb_p (bi_call))
{
/* We checked that there was a fallthrough edge in
can_guard_call_p. */
join_tgt_in_edge_from_call = find_fallthru_edge (bi_call_bb->succs);
gcc_assert (join_tgt_in_edge_from_call);
free_dominance_info (CDI_DOMINATORS);
}
if we split the edge everything is fine. Otherwise the pass needs to handle
PHIs in join_tgt_in_edge_from_call->dest. So we can conditionally split
only.
Index: gcc/tree-call-cdce.c
===================================================================
--- gcc/tree-call-cdce.c (revision 241902)
+++ gcc/tree-call-cdce.c (working copy)
@@ -800,15 +800,21 @@ shrink_wrap_one_built_in_call_with_conds
join_tgt_in_edge_from_call = find_fallthru_edge (bi_call_bb->succs);
if (join_tgt_in_edge_from_call == NULL)
return false;
+ /* 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);
+ else
+ join_tgt_bb = join_tgt_in_edge_from_call->dest;
free_dominance_info (CDI_DOMINATORS);
}
else
- join_tgt_in_edge_from_call = split_block (bi_call_bb, bi_call);
+ {
+ join_tgt_in_edge_from_call = split_block (bi_call_bb, bi_call);
+ join_tgt_bb = join_tgt_in_edge_from_call->dest;
+ }
bi_call_bsi = gsi_for_stmt (bi_call);
- join_tgt_bb = join_tgt_in_edge_from_call->dest;
-
/* Now it is time to insert the first conditional expression
into bi_call_bb and split this bb so that bi_call is
shrink-wrapped. */
similar patch works on trunk.