[PATCH] Add checking that during RTL bbs don't mix EH and non-complex predecessor edges
Jakub Jelinek
jakub@redhat.com
Fri Jun 15 19:19:00 GMT 2018
On Fri, Jun 15, 2018 at 09:06:16PM +0200, Jakub Jelinek wrote:
> The following patch fixes it by making sure we don't have EH landing pads
> that are reachable also by the crossing edges by splitting the EH landing
> pad bb we want to jump into and jumping (EDGE_CROSSING) only to the second
> half, leaving the first part with no actual instructions to be the EH
> landing pad.
The following patch adds verification that we don't have such basic blocks
during RTL optimizations.
Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
Eric, I wonder if sjlj doesn't need a similar fix to the PR86108 patch.
If it does, I think with the following patch it would trigger a checking
failure. Not familiar with sjlj EH enough to try it myself.
2018-06-15 Jakub Jelinek <jakub@redhat.com>
* cfgrtl.c (rtl_verify_edges): Formatting fix. If bb_has_eh_pred,
verify all incoming edges are complex.
--- gcc/cfgrtl.c.jj 2018-04-09 20:15:51.237631514 +0200
+++ gcc/cfgrtl.c 2018-06-15 18:15:37.479333131 +0200
@@ -2540,15 +2540,15 @@ rtl_verify_edges (void)
n_abnormal++;
}
- if (!has_crossing_edge
- && JUMP_P (BB_END (bb))
- && CROSSING_JUMP_P (BB_END (bb)))
- {
- print_rtl_with_bb (stderr, get_insns (), TDF_BLOCKS | TDF_DETAILS);
- error ("Region crossing jump across same section in bb %i",
- bb->index);
- err = 1;
- }
+ if (!has_crossing_edge
+ && JUMP_P (BB_END (bb))
+ && CROSSING_JUMP_P (BB_END (bb)))
+ {
+ print_rtl_with_bb (stderr, get_insns (), TDF_BLOCKS | TDF_DETAILS);
+ error ("Region crossing jump across same section in bb %i",
+ bb->index);
+ err = 1;
+ }
if (n_eh && !find_reg_note (BB_END (bb), REG_EH_REGION, NULL_RTX))
{
@@ -2606,6 +2606,18 @@ rtl_verify_edges (void)
error ("abnormal edges for no purpose in bb %i", bb->index);
err = 1;
}
+ if (bb_has_eh_pred (bb))
+ {
+ FOR_EACH_EDGE (e, ei, bb->preds)
+ {
+ if (e->flags & EDGE_COMPLEX)
+ continue;
+ error ("EH incoming edge mixed with non-complex incoming edges "
+ "in bb %i", bb->index);
+ err = 1;
+ break;
+ }
+ }
}
/* If there are partitions, do a sanity check on them: A basic block in
Jakub
More information about the Gcc-patches
mailing list