Add missing single_pred_p test in scop_detection::merge_sese

2016-03-16  Tom de Vries  <tom@codesourcery.com>

	PR tree-optimization/68715
	* graphite-scop-detection.c (scop_detection::merge_sese): Add missing
	single_pred_p test.

	* gcc.dg/graphite/pr68715-2.c: New test.
	* gcc.dg/graphite/pr68715.c: New test.
	* gfortran.dg/graphite/pr68715.f90: New test.

From-SVN: r234251
This commit is contained in:
Tom de Vries 2016-03-16 09:19:23 +00:00 committed by Tom de Vries
parent be7ce7aefd
commit 7662b718e1
6 changed files with 118 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2016-03-16 Tom de Vries <tom@codesourcery.com>
PR tree-optimization/68715
* graphite-scop-detection.c (scop_detection::merge_sese): Add missing
single_pred_p test.
2016-03-16 Tom de Vries <tom@codesourcery.com>
PR tree-optimization/68809

View File

@ -836,7 +836,9 @@ scop_detection::merge_sese (sese_l first, sese_l second) const
{
/* Find the first empty succ (with single exit) of combined.exit. */
basic_block imm_succ = combined.exit->dest;
if (single_succ_p (imm_succ) && trivially_empty_bb_p (imm_succ))
if (single_succ_p (imm_succ)
&& single_pred_p (imm_succ)
&& trivially_empty_bb_p (imm_succ))
combined.exit = single_succ_edge (imm_succ);
else
{

View File

@ -1,3 +1,10 @@
2016-03-16 Tom de Vries <tom@codesourcery.com>
PR tree-optimization/68715
* gcc.dg/graphite/pr68715-2.c: New test.
* gcc.dg/graphite/pr68715.c: New test.
* gfortran.dg/graphite/pr68715.f90: New test.
2016-03-16 Tom de Vries <tom@codesourcery.com>
PR tree-optimization/68809

View File

@ -0,0 +1,35 @@
/* { dg-do compile } */
/* { dg-options "-Ofast -floop-interchange" } */
int a, b, c, d, f, g;
int e[1], h[1];
void fn2 ();
void fn3 ();
void
fn1 ()
{
fn2 ();
b = 0;
for (; b < 10; b++)
;
}
void
fn2 ()
{
if (a)
{
fn3 ();
c = d;
}
}
void
fn3 ()
{
for (; g; g++)
e[g] = 2;
if (f)
for (; g; g++)
h[g] = 5;
}

View File

@ -0,0 +1,36 @@
/* { dg-do compile } */
/* { dg-options "-O2 -floop-interchange" } */
int a[1], c[1];
int b, d, e;
void
fn1 (int p1)
{
for (;;)
;
}
int
fn3 ()
{
for (; e; e++)
c[e] = 2;
for (; d; d--)
a[d] = 8;
return 0;
}
int fn5 (int);
int
fn2 ()
{
fn3 ();
}
void
fn4 ()
{
fn1 (b || fn5 (fn2 ()));
}

View File

@ -0,0 +1,31 @@
! { dg-do compile }
! { dg-options "-floop-nest-optimize -O1" }
SUBROUTINE se_core_core_interaction(calculate_forces)
INTEGER, PARAMETER :: dp=8
LOGICAL, INTENT(in) :: calculate_forces
REAL(KIND=dp), DIMENSION(3) :: force_ab, rij
LOGICAL :: lfoo,kfoo,mfoo,nfoo,ffoo
INTEGER, PARAMETER :: mi2=42
CALL dummy(lfoo,kfoo,mfoo,nfoo,method_id,core_core)
IF (lfoo) THEN
DO WHILE (ffoo())
IF (lfoo) CYCLE
IF (kfoo) CYCLE
dr1 = DOT_PRODUCT(rij,rij)
IF (dr1 > rij_threshold) THEN
SELECT CASE (method_id)
CASE (mi2)
IF (calculate_forces) THEN
CALL dummy2(force_ab)
IF (nfoo) THEN
force_ab = force_ab + core_core*dr3inv
END IF
END IF
END SELECT
END IF
enuclear = enuclear + enucij
END DO
CALL dummy3(enuclear)
END IF
END SUBROUTINE se_core_core_interaction