This cherry-picks two fixes from the move-to-isl-and-isl-scheduler git graphite branch.
Bootstrapped on x86_64-unknown-linux-gnu, testing in progress. Richard. 2012-06-22 Richard Guenther <rguent...@suse.de> Merge from graphite branch 2011-08-10 Sebastian Pop <seb...@gmail.com> * graphite-sese-to-poly.c (build_scop_drs): Fix memory leak. 2012-01-13 Tobias Grosser <tob...@grosser.es> * tree-flow.h (parallelized_function_p): Declare. * tree-parloops.c (parallelized_function_p): Export. * graphite.c (graphite_transform_loops): Do not run graphite on already parallel functions. libgomp/ * testsuite/libgomp.graphite/force-parallel-1.c: Adjust. * testsuite/libgomp.graphite/force-parallel-2.c: Likewise. diff --git a/gcc/graphite-sese-to-poly.c b/gcc/graphite-sese-to-poly.c index 555100f..31e5218 100644 --- a/gcc/graphite-sese-to-poly.c +++ b/gcc/graphite-sese-to-poly.c @@ -1991,6 +1991,7 @@ build_scop_drs (scop_p scop) if (VEC_empty (data_reference_p, GBB_DATA_REFS (PBB_BLACK_BOX (pbb)))) { free_gimple_bb (PBB_BLACK_BOX (pbb)); + free_poly_bb (pbb); VEC_ordered_remove (poly_bb_p, SCOP_BBS (scop), i); i--; } commit aeeb472ced57e8142ccaabd39e104a90576f8b8c Author: Tobias Grosser <tob...@grosser.es> Date: Fri Jan 13 22:15:39 2012 +0100 Do not run graphite on already parallel functions diff --git a/gcc/graphite.c b/gcc/graphite.c index b013447..85a87e7 100644 --- a/gcc/graphite.c +++ b/gcc/graphite.c @@ -253,6 +254,11 @@ graphite_transform_loops (void) VEC (scop_p, heap) *scops = NULL; htab_t bb_pbb_mapping; + /* If a function is parallel it was most probably already run through graphite + once. No need to run again. */ + if (parallelized_function_p (cfun->decl)) + return; + if (!graphite_initialize ()) return; diff --git a/gcc/tree-flow.h b/gcc/tree-flow.h index cefc9c0..40935f2 100644 --- a/gcc/tree-flow.h +++ b/gcc/tree-flow.h @@ -858,6 +858,9 @@ void warn_function_noreturn (tree); /* In tree-ssa-ter.c */ bool stmt_is_replaceable_p (gimple); +/* In tree-parloops.c */ +bool parallelized_function_p (tree); + #include "tree-flow-inline.h" void swap_tree_operands (gimple, tree *, tree *); diff --git a/gcc/tree-parloops.c b/gcc/tree-parloops.c index e95bf4c..86036b4 100644 --- a/gcc/tree-parloops.c +++ b/gcc/tree-parloops.c @@ -1394,7 +1394,7 @@ static GTY(()) bitmap parallelized_functions; /* Returns true if FN was created by create_loop_fn. */ -static bool +bool parallelized_function_p (tree fn) { if (!parallelized_functions || !DECL_ARTIFICIAL (fn)) diff --git a/libgomp/testsuite/libgomp.graphite/force-parallel-1.c b/libgomp/testsuite/libgomp.graphite/force-parallel-1.c index d168b43..8c40e34 100644 --- a/libgomp/testsuite/libgomp.graphite/force-parallel-1.c +++ b/libgomp/testsuite/libgomp.graphite/force-parallel-1.c @@ -24,7 +24,7 @@ int main(void) } /* Check that parallel code generation part make the right answer. */ -/* { dg-final { scan-tree-dump-times "1 loops carried no dependency" 2 "graphite" } } */ +/* { dg-final { scan-tree-dump-times "1 loops carried no dependency" 1 "graphite" } } */ /* { dg-final { cleanup-tree-dump "graphite" } } */ /* { dg-final { scan-tree-dump-times "loopfn" 5 "optimized" } } */ /* { dg-final { cleanup-tree-dump "parloops" } } */ diff --git a/libgomp/testsuite/libgomp.graphite/force-parallel-2.c b/libgomp/testsuite/libgomp.graphite/force-parallel-2.c index 03d8236..1ce0feb 100644 --- a/libgomp/testsuite/libgomp.graphite/force-parallel-2.c +++ b/libgomp/testsuite/libgomp.graphite/force-parallel-2.c @@ -23,7 +23,7 @@ int main(void) } /* Check that parallel code generation part make the right answer. */ -/* { dg-final { scan-tree-dump-times "2 loops carried no dependency" 2 "graphite" } } */ +/* { dg-final { scan-tree-dump-times "2 loops carried no dependency" 1 "graphite" } } */ /* { dg-final { cleanup-tree-dump "graphite" } } */ /* { dg-final { scan-tree-dump-times "loopfn" 5 "optimized" } } */ /* { dg-final { cleanup-tree-dump "parloops" } } */