Line
Link Here
|
0 |
-- a/gcc/graphite-scop-detection.c |
0 |
++ b/gcc/graphite-scop-detection.c |
Lines 905-910
scop_detection::build_scop_breadth (sese_l s1, loop_p loop)
Link Here
|
905 |
|
905 |
|
906 |
sese_l combined = merge_sese (s1, s2); |
906 |
sese_l combined = merge_sese (s1, s2); |
907 |
|
907 |
|
|
|
908 |
/* Combining adjacent loops may add unrelated loops into the |
909 |
region so we have to check all sub-loops of the outer loop |
910 |
that are in the combined region. */ |
911 |
if (combined) |
912 |
for (l = loop_outer (loop)->inner; l; l = l->next) |
913 |
if (bb_in_sese_p (l->header, combined) |
914 |
&& ! loop_is_valid_in_scop (l, combined)) |
915 |
{ |
916 |
combined = invalid_sese; |
917 |
break; |
918 |
} |
919 |
|
908 |
if (combined) |
920 |
if (combined) |
909 |
s1 = combined; |
921 |
s1 = combined; |
910 |
else |
922 |
else |
Lines 931-936
scop_detection::can_represent_loop_1 (loop_p loop, sese_l scop)
Link Here
|
931 |
&& niter_desc.control.no_overflow |
943 |
&& niter_desc.control.no_overflow |
932 |
&& (niter = number_of_latch_executions (loop)) |
944 |
&& (niter = number_of_latch_executions (loop)) |
933 |
&& !chrec_contains_undetermined (niter) |
945 |
&& !chrec_contains_undetermined (niter) |
|
|
946 |
&& !chrec_contains_undetermined (scalar_evolution_in_region (scop, |
947 |
loop, niter)) |
934 |
&& graphite_can_represent_expr (scop, loop, niter); |
948 |
&& graphite_can_represent_expr (scop, loop, niter); |
935 |
} |
949 |
} |
936 |
|
950 |
|
937 |
-- a/gcc/graphite-sese-to-poly.c |
951 |
++ b/gcc/graphite-sese-to-poly.c |
Lines 407-413
extract_affine (scop_p s, tree e, __isl_take isl_space *space)
Link Here
|
407 |
|
407 |
|
408 |
case SSA_NAME: |
408 |
case SSA_NAME: |
409 |
gcc_assert (-1 != parameter_index_in_region_1 (e, s->scop_info) |
409 |
gcc_assert (-1 != parameter_index_in_region_1 (e, s->scop_info) |
410 |
|| !invariant_in_sese_p_rec (e, s->scop_info->region, NULL)); |
410 |
|| defined_in_sese_p (e, s->scop_info->region)); |
411 |
res = extract_affine_name (s, e, space); |
411 |
res = extract_affine_name (s, e, space); |
412 |
break; |
412 |
break; |
413 |
|
413 |
|
Lines 436-446
extract_affine (scop_p s, tree e, __isl_take isl_space *space)
Link Here
|
436 |
/* Returns a linear expression for tree T evaluated in PBB. */ |
436 |
/* Returns a linear expression for tree T evaluated in PBB. */ |
437 |
|
437 |
|
438 |
static isl_pw_aff * |
438 |
static isl_pw_aff * |
439 |
create_pw_aff_from_tree (poly_bb_p pbb, tree t) |
439 |
create_pw_aff_from_tree (poly_bb_p pbb, loop_p loop, tree t) |
440 |
{ |
440 |
{ |
441 |
scop_p scop = PBB_SCOP (pbb); |
441 |
scop_p scop = PBB_SCOP (pbb); |
442 |
|
442 |
|
443 |
t = scalar_evolution_in_region (scop->scop_info->region, pbb_loop (pbb), t); |
443 |
t = scalar_evolution_in_region (scop->scop_info->region, loop, t); |
444 |
|
444 |
|
445 |
gcc_assert (!chrec_contains_undetermined (t)); |
445 |
gcc_assert (!chrec_contains_undetermined (t)); |
446 |
gcc_assert (!automatically_generated_chrec_p (t)); |
446 |
gcc_assert (!automatically_generated_chrec_p (t)); |
Lines 455-462
create_pw_aff_from_tree (poly_bb_p pbb, tree t)
Link Here
|
455 |
static void |
455 |
static void |
456 |
add_condition_to_pbb (poly_bb_p pbb, gcond *stmt, enum tree_code code) |
456 |
add_condition_to_pbb (poly_bb_p pbb, gcond *stmt, enum tree_code code) |
457 |
{ |
457 |
{ |
458 |
isl_pw_aff *lhs = create_pw_aff_from_tree (pbb, gimple_cond_lhs (stmt)); |
458 |
loop_p loop = gimple_bb (stmt)->loop_father; |
459 |
isl_pw_aff *rhs = create_pw_aff_from_tree (pbb, gimple_cond_rhs (stmt)); |
459 |
isl_pw_aff *lhs = create_pw_aff_from_tree (pbb, loop, gimple_cond_lhs (stmt)); |
|
|
460 |
isl_pw_aff *rhs = create_pw_aff_from_tree (pbb, loop, gimple_cond_rhs (stmt)); |
460 |
|
461 |
|
461 |
isl_set *cond; |
462 |
isl_set *cond; |
462 |
switch (code) |
463 |
switch (code) |
463 |
-- /dev/null |
464 |
++ b/gcc/testsuite/gcc.dg/graphite/pr71824-2.c |
Line 0
Link Here
|
0 |
-- /dev/null |
1 |
/* { dg-do compile } */ |
|
|
2 |
/* { dg-options "-O2 -floop-nest-optimize" } */ |
3 |
|
4 |
typedef struct { float x1; } bx; |
5 |
typedef struct { |
6 |
int w; |
7 |
short o; |
8 |
} T2P; |
9 |
T2P a; |
10 |
int b; |
11 |
void fn2(); |
12 |
void fn3(bx*,short); |
13 |
void fn1() { |
14 |
unsigned i = 0; |
15 |
int c; |
16 |
bx *d; |
17 |
bx **h; |
18 |
if (b == 0) { |
19 |
fn2(); |
20 |
return; |
21 |
} |
22 |
for (; c; c++) |
23 |
for (; i < 100; i++) { |
24 |
d = h[i]; |
25 |
d->x1 = a.w; |
26 |
} |
27 |
for (; i < 100; i++) { |
28 |
d = h[i]; |
29 |
d->x1 = a.w; |
30 |
} |
31 |
if (a.o) |
32 |
for (; b;) |
33 |
fn3(d, a.o); |
34 |
} |
|
|
35 |
++ b/gcc/testsuite/gcc.dg/graphite/pr71824-3.c |
Line 0
Link Here
|
0 |
-- /dev/null |
1 |
/* { dg-do compile } */ |
|
|
2 |
/* { dg-options "-O2 -ftree-loop-distribution -floop-nest-optimize" } */ |
3 |
|
4 |
struct |
5 |
{ |
6 |
int bz; |
7 |
} od, ka[2]; |
8 |
|
9 |
int fw; |
10 |
|
11 |
void |
12 |
pc (void) |
13 |
{ |
14 |
for (od.bz = 0; od.bz < 2; ++od.bz) |
15 |
{ |
16 |
++fw; |
17 |
ka[0] = ka[1]; |
18 |
} |
19 |
} |
|
|
20 |
++ b/gcc/testsuite/gcc.dg/graphite/pr71824.c |
Line 0
Link Here
|
|
|
1 |
/* { dg-do compile } */ |
2 |
/* { dg-options "-O2 -floop-nest-optimize" } */ |
3 |
|
4 |
int a, b, d; |
5 |
int **c; |
6 |
int fn1() { |
7 |
while (a) |
8 |
if (d) { |
9 |
int e = -d; |
10 |
for (; b < e; b++) |
11 |
c[b] = &a; |
12 |
} else { |
13 |
for (; b; b++) |
14 |
c[b] = &b; |
15 |
d = 0; |
16 |
} |
17 |
} |