diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1ac849fed6f..cc806091911 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2008-10-15 Sebastian Pop + Harsha Jagasia + + PR tree-optimization/37828 + * graphite.c (graphite_trans_loop_block): Do not loop block + single nested loops. + 2008-10-15 Sebastian Pop PR tree-optimization/37686 diff --git a/gcc/graphite.c b/gcc/graphite.c index a615e2c1e49..c31c305cf99 100644 --- a/gcc/graphite.c +++ b/gcc/graphite.c @@ -4767,13 +4767,19 @@ graphite_trans_loop_block (VEC (graphite_bb_p, heap) *bbs, int loops) /* TODO: - Calculate the stride size automatically. */ int stride_size = 64; + /* It makes no sense to block a single loop. */ + for (i = 0; VEC_iterate (graphite_bb_p, bbs, i, gb); i++) + if (gbb_nb_loops (gb) < 2) + return false; + for (i = 0; VEC_iterate (graphite_bb_p, bbs, i, gb); i++) transform_done |= graphite_trans_bb_block (gb, stride_size, loops); return transform_done; } -/* Loop block all basic blocks of SCOP. */ +/* Loop block all basic blocks of SCOP. Return false when the + transform is not performed. */ static bool graphite_trans_scop_block (scop_p scop) @@ -4790,10 +4796,10 @@ graphite_trans_scop_block (scop_p scop) lambda_vector last_schedule = lambda_vector_new (max_schedule); if (VEC_length (graphite_bb_p, SCOP_BBS (scop)) == 0) - return transform_done; + return false; /* Get the data of the first bb. */ - gb = VEC_index (graphite_bb_p, SCOP_BBS (scop), 0); + gb = VEC_index (graphite_bb_p, SCOP_BBS (scop), 0); last_nb_loops = gbb_nb_loops (gb); lambda_vector_copy (GBB_STATIC_SCHEDULE (gb), last_schedule, last_nb_loops + 1); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 328a51412b0..91966c4a288 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2008-10-15 Sebastian Pop + Harsha Jagasia + + PR tree-optimization/37828 + * testsuite/gcc.dg/graphite/pr37828.c: New. + 2008-10-15 Sebastian Pop PR tree-optimization/37686 diff --git a/gcc/testsuite/gcc.dg/graphite/pr37828.c b/gcc/testsuite/gcc.dg/graphite/pr37828.c new file mode 100644 index 00000000000..0a0412d8045 --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/pr37828.c @@ -0,0 +1,25 @@ +/* { dg-options "-O2 -floop-block" } */ + +typedef struct foo +{ + struct foo **Node; +} foo; + +static int sort_and_split (foo **Root, foo **Finite, long first) +{ + foo *cd; + long i; + for (i = 0; i < first; i++) + cd->Node[i] = Finite[first+i]; + + sort_and_split(Root, Finite, first); + return (0); +} + + +void Build_foo(foo **Root, foo **Finite, foo **Infinite) +{ + long low, high; + while (sort_and_split(Root, Finite, low) == 0); +} +