From: Tom de Vries Date: Thu, 22 Mar 2018 10:21:12 +0000 (+0000) Subject: [tail-merge] Don't merge bbs with bb_has_abnormal_pred X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=71b7c365f973b2a9c556f47290328805e886be31;p=gcc.git [tail-merge] Don't merge bbs with bb_has_abnormal_pred 2018-03-22 Tom de Vries PR tree-optimization/84956 * tree-ssa-tail-merge.c (find_clusters_1): Skip bbs with bb_has_abnormal_pred. * gcc.dg/pr84956.c: New test. From-SVN: r258758 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 869caa2fe6d..06320e4c802 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2018-03-22 Tom de Vries + + PR tree-optimization/84956 + * tree-ssa-tail-merge.c (find_clusters_1): Skip bbs with + bb_has_abnormal_pred. + 2018-03-22 Jakub Jelinek PR sanitizer/85018 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 00b804c7018..abc1b9fb76a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-03-22 Tom de Vries + + PR tree-optimization/84956 + * gcc.dg/pr84956.c: New test. + 2018-03-22 Marek Polacek PR c++/84854 diff --git a/gcc/testsuite/gcc.dg/pr84956.c b/gcc/testsuite/gcc.dg/pr84956.c new file mode 100644 index 00000000000..055a749d635 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr84956.c @@ -0,0 +1,27 @@ +/* { dg-options "-O2 -ftree-tail-merge" } */ + +char a; +int c; +unsigned b (); + +unsigned +setjmp () +{ +} + +static void +d () +{ + if (b ()) + c = 3; +} + +void +e () +{ + d (); + a && ({ setjmp (); }); + a && ({ setjmp (); }); + a && ({ setjmp (); }); +} + diff --git a/gcc/tree-ssa-tail-merge.c b/gcc/tree-ssa-tail-merge.c index a687c3f28df..f482ce197cd 100644 --- a/gcc/tree-ssa-tail-merge.c +++ b/gcc/tree-ssa-tail-merge.c @@ -1455,7 +1455,8 @@ find_clusters_1 (same_succ *same_succ) /* TODO: handle blocks with phi-nodes. We'll have to find corresponding phi-nodes in bb1 and bb2, with the same alternatives for the same preds. */ - if (bb_has_non_vop_phi (bb1) || bb_has_eh_pred (bb1)) + if (bb_has_non_vop_phi (bb1) || bb_has_eh_pred (bb1) + || bb_has_abnormal_pred (bb1)) continue; nr_comparisons = 0; @@ -1463,7 +1464,8 @@ find_clusters_1 (same_succ *same_succ) { bb2 = BASIC_BLOCK_FOR_FN (cfun, j); - if (bb_has_non_vop_phi (bb2) || bb_has_eh_pred (bb2)) + if (bb_has_non_vop_phi (bb2) || bb_has_eh_pred (bb2) + || bb_has_abnormal_pred (bb2)) continue; if (BB_CLUSTER (bb1) != NULL && BB_CLUSTER (bb1) == BB_CLUSTER (bb2))