[tail-merge] Don't merge bbs with bb_has_abnormal_pred

2018-03-22  Tom de Vries  <tom@codesourcery.com>

	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
This commit is contained in:
Tom de Vries 2018-03-22 10:21:12 +00:00 committed by Tom de Vries
parent f13ed3ed23
commit 71b7c365f9
4 changed files with 42 additions and 2 deletions

View File

@ -1,3 +1,9 @@
2018-03-22 Tom de Vries <tom@codesourcery.com>
PR tree-optimization/84956
* tree-ssa-tail-merge.c (find_clusters_1): Skip bbs with
bb_has_abnormal_pred.
2018-03-22 Jakub Jelinek <jakub@redhat.com>
PR sanitizer/85018

View File

@ -1,3 +1,8 @@
2018-03-22 Tom de Vries <tom@codesourcery.com>
PR tree-optimization/84956
* gcc.dg/pr84956.c: New test.
2018-03-22 Marek Polacek <polacek@redhat.com>
PR c++/84854

View File

@ -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 (); });
}

View File

@ -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))