Commit 197d2f5b by Richard Biener Committed by Richard Biener

re PR tree-optimization/69728 (internal compiler error: in…

re PR tree-optimization/69728 (internal compiler error: in outer_projection_mupa, at graphite-sese-to-poly.c:1175)

2017-09-19  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/69728
	* graphite-sese-to-poly.c (schedule_error): New global.
	(add_loop_schedule): Handle empty domain by failing the
	schedule.
	(build_original_schedule): Handle schedule_error.

	* gfortran.dg/graphite/pr69728.f90: New testcase.
	* gcc.dg/graphite/pr69728.c: Likewise.

From-SVN: r252968
parent 6da7ce80
2017-09-19 Richard Biener <rguenther@suse.de> 2017-09-19 Richard Biener <rguenther@suse.de>
PR tree-optimization/69728
* graphite-sese-to-poly.c (schedule_error): New global.
(add_loop_schedule): Handle empty domain by failing the
schedule.
(build_original_schedule): Handle schedule_error.
2017-09-19 Richard Biener <rguenther@suse.de>
* graphite-scop-detection.c (scop_detection::can_represent_loop): * graphite-scop-detection.c (scop_detection::can_represent_loop):
Do not iterate to sibling loops but only to siblings of inner Do not iterate to sibling loops but only to siblings of inner
loops. loops.
......
...@@ -1030,6 +1030,8 @@ outer_projection_mupa (__isl_take isl_union_set *set, int n) ...@@ -1030,6 +1030,8 @@ outer_projection_mupa (__isl_take isl_union_set *set, int n)
return isl_multi_union_pw_aff_from_union_pw_multi_aff (data.res); return isl_multi_union_pw_aff_from_union_pw_multi_aff (data.res);
} }
static bool schedule_error;
/* Embed SCHEDULE in the constraints of the LOOP domain. */ /* Embed SCHEDULE in the constraints of the LOOP domain. */
static isl_schedule * static isl_schedule *
...@@ -1043,6 +1045,16 @@ add_loop_schedule (__isl_take isl_schedule *schedule, loop_p loop, ...@@ -1043,6 +1045,16 @@ add_loop_schedule (__isl_take isl_schedule *schedule, loop_p loop,
if (empty < 0 || empty) if (empty < 0 || empty)
return empty < 0 ? isl_schedule_free (schedule) : schedule; return empty < 0 ? isl_schedule_free (schedule) : schedule;
isl_union_set *domain = isl_schedule_get_domain (schedule);
/* We cannot apply an empty domain to pbbs in this loop so fail.
??? Somehow drop pbbs in the loop instead. */
if (isl_union_set_is_empty (domain))
{
schedule_error = true;
isl_union_set_free (domain);
return schedule;
}
isl_space *space = isl_set_get_space (iterators); isl_space *space = isl_set_get_space (iterators);
int loop_index = isl_space_dim (space, isl_dim_set) - 1; int loop_index = isl_space_dim (space, isl_dim_set) - 1;
...@@ -1063,7 +1075,6 @@ add_loop_schedule (__isl_take isl_schedule *schedule, loop_p loop, ...@@ -1063,7 +1075,6 @@ add_loop_schedule (__isl_take isl_schedule *schedule, loop_p loop,
prefix = isl_multi_aff_set_tuple_id (prefix, isl_dim_out, label); prefix = isl_multi_aff_set_tuple_id (prefix, isl_dim_out, label);
int n = isl_multi_aff_dim (prefix, isl_dim_in); int n = isl_multi_aff_dim (prefix, isl_dim_in);
isl_union_set *domain = isl_schedule_get_domain (schedule);
isl_multi_union_pw_aff *mupa = outer_projection_mupa (domain, n); isl_multi_union_pw_aff *mupa = outer_projection_mupa (domain, n);
mupa = isl_multi_union_pw_aff_apply_multi_aff (mupa, prefix); mupa = isl_multi_union_pw_aff_apply_multi_aff (mupa, prefix);
return isl_schedule_insert_partial_schedule (schedule, mupa); return isl_schedule_insert_partial_schedule (schedule, mupa);
...@@ -1169,6 +1180,8 @@ build_schedule_loop_nest (scop_p scop, int *index, loop_p context_loop) ...@@ -1169,6 +1180,8 @@ build_schedule_loop_nest (scop_p scop, int *index, loop_p context_loop)
static bool static bool
build_original_schedule (scop_p scop) build_original_schedule (scop_p scop)
{ {
schedule_error = false;
int i = 0; int i = 0;
int n = scop->pbbs.length (); int n = scop->pbbs.length ();
while (i < n) while (i < n)
...@@ -1183,6 +1196,14 @@ build_original_schedule (scop_p scop) ...@@ -1183,6 +1196,14 @@ build_original_schedule (scop_p scop)
scop->original_schedule = add_in_sequence (scop->original_schedule, s); scop->original_schedule = add_in_sequence (scop->original_schedule, s);
} }
if (schedule_error)
{
if (dump_file)
fprintf (dump_file, "[sese-to-poly] failed to build "
"original schedule\n");
return false;
}
if (dump_file) if (dump_file)
{ {
fprintf (dump_file, "[sese-to-poly] original schedule:\n"); fprintf (dump_file, "[sese-to-poly] original schedule:\n");
......
2017-09-19 Richard Biener <rguenther@suse.de>
PR tree-optimization/69728
* gfortran.dg/graphite/pr69728.f90: New testcase.
* gcc.dg/graphite/pr69728.c: Likewise.
2017-09-18 Paolo Carlini <paolo.carlini@oracle.com> 2017-09-18 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/80947 PR c++/80947
......
/* { dg-do compile } */
/* { dg-options "-O3 -floop-nest-optimize" } */
int a[1];
int b, c, d, e;
void
fn1 ()
{
d = 9;
for (; c; c++)
{
++d;
b = 8;
for (; b; b--)
{
if (d)
break;
a[b] = e;
}
}
}
! { dg-do compile }
! { dg-options "-O3 -floop-nest-optimize" }
SUBROUTINE rk_addtend_dry ( t_tend, t_tendf, t_save, rk_step, &
h_diabatic, mut, msft, ide, jde, &
ims,ime, jms,jme, kms,kme, &
its,ite, jts,jte, kts,kte)
IMPLICIT NONE
INTEGER , INTENT(IN ) :: ide, jde, ims, ime, jms, jme, kms, kme, &
its, ite, jts, jte, kts, kte
INTEGER , INTENT(IN ) :: rk_step
REAL , DIMENSION( ims:ime , kms:kme, jms:jme ), &
INTENT(INOUT) :: t_tend, t_tendf
REAL , DIMENSION( ims:ime , kms:kme, jms:jme ) , &
INTENT(IN ) :: t_save, h_diabatic
REAL , DIMENSION( ims:ime , jms:jme ) , INTENT(IN ) :: mut, msft
INTEGER :: i, j, k
DO j = jts,MIN(jte,jde-1)
DO k = kts,kte-1
DO i = its,MIN(ite,ide-1)
IF(rk_step == 1)t_tendf(i,k,j) = t_tendf(i,k,j) + t_save(i,k,j)
t_tend(i,k,j) = t_tend(i,k,j) + t_tendf(i,k,j)/msft(i,j) &
+ mut(i,j)*h_diabatic(i,k,j)/msft(i,j)
ENDDO
ENDDO
ENDDO
END SUBROUTINE rk_addtend_dry
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment