summaryrefslogtreecommitdiff
path: root/gcc/graphite.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2017-10-13 11:02:05 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2017-10-13 11:02:05 +0000
commit6fe00fb72a2618c00909c794b1a1a792a2fdaf68 (patch)
treef699d44ad82bb3e0fb7147cf79828619b321a23d /gcc/graphite.c
parent1a8821c54a5ff570e5d6005924ab9a165090d1cd (diff)
2017-10-13 Richard Biener <rguenther@suse.de>
* graphite-isl-ast-to-gimple.c (translate_isl_ast_to_gimple::get_rename_from_scev): Remove unused parameters and dominance check. (translate_isl_ast_to_gimple::graphite_copy_stmts_from_block): Adjust. (translate_isl_ast_to_gimple::copy_bb_and_scalar_dependences): Likewise. (translate_isl_ast_to_gimple::graphite_regenerate_ast_isl): Do not update SSA form here or do intermediate IL verification. * graphite.c: Include tree-ssa.h and tree-into-ssa.h. (graphite_initialize): Remove check on the number of loops in the function and inline into graphite_transform_loops. (graphite_finalize): Inline into graphite_transform_loops. (graphite_transform_loops): Perform SSA update and IL verification here. * params.def (PARAM_GRAPHITE_MIN_LOOPS_PER_FUNCTION): Remove. * gcc.dg/graphite/pr35356-3.c: XFAIL again. * gcc.dg/graphite/pr81373-2.c: Copy from gcc.dg/graphite/pr81373.c with alternate flags. From-SVN: r253720
Diffstat (limited to 'gcc/graphite.c')
-rw-r--r--gcc/graphite.c87
1 files changed, 24 insertions, 63 deletions
diff --git a/gcc/graphite.c b/gcc/graphite.c
index 0bdcc28cba8..d11de71a9b8 100644
--- a/gcc/graphite.c
+++ b/gcc/graphite.c
@@ -55,6 +55,8 @@ along with GCC; see the file COPYING3. If not see
#include "tree-cfgcleanup.h"
#include "tree-vectorizer.h"
#include "tree-ssa-loop-manip.h"
+#include "tree-ssa.h"
+#include "tree-into-ssa.h"
#include "graphite.h"
/* Print global statistics to FILE. */
@@ -212,64 +214,6 @@ print_graphite_statistics (FILE* file, vec<scop_p> scops)
print_loops (file, 3);
}
-/* Initialize graphite: when there are no loops returns false. */
-
-static bool
-graphite_initialize (void)
-{
- int min_loops = PARAM_VALUE (PARAM_GRAPHITE_MIN_LOOPS_PER_FUNCTION);
- int nloops = number_of_loops (cfun);
-
- if (nloops <= min_loops)
- {
- if (dump_file && (dump_flags & TDF_DETAILS))
- {
- if (nloops <= min_loops)
- fprintf (dump_file, "\nFunction does not have enough loops: "
- "PARAM_GRAPHITE_MIN_LOOPS_PER_FUNCTION = %d.\n",
- min_loops);
-
- fprintf (dump_file, "\nnumber of SCoPs: 0\n");
- print_global_statistics (dump_file);
- }
-
- return false;
- }
-
- calculate_dominance_info (CDI_DOMINATORS);
- initialize_original_copy_tables ();
-
- if (dump_file && dump_flags)
- {
- dump_function_to_file (current_function_decl, dump_file, dump_flags);
- print_loops (dump_file, 3);
- }
-
- return true;
-}
-
-/* Finalize graphite: perform CFG cleanup when NEED_CFG_CLEANUP_P is
- true. */
-
-static void
-graphite_finalize (bool need_cfg_cleanup_p)
-{
- if (need_cfg_cleanup_p)
- {
- free_dominance_info (CDI_DOMINATORS);
- scev_reset ();
- cleanup_tree_cfg ();
- profile_status_for_fn (cfun) = PROFILE_ABSENT;
- release_recorded_exits (cfun);
- tree_estimate_probability (false);
- }
-
- free_original_copy_tables ();
-
- if (dump_file && dump_flags)
- print_loops (dump_file, 3);
-}
-
/* Deletes all scops in SCOPS. */
static void
@@ -396,7 +340,7 @@ graphite_transform_loops (void)
{
int i;
scop_p scop;
- bool need_cfg_cleanup_p = false;
+ bool changed = false;
vec<scop_p> scops = vNULL;
isl_ctx *ctx;
@@ -405,8 +349,7 @@ graphite_transform_loops (void)
if (parallelized_function_p (cfun->decl))
return;
- if (!graphite_initialize ())
- return;
+ calculate_dominance_info (CDI_DOMINATORS);
ctx = isl_ctx_alloc ();
isl_options_set_on_error (ctx, ISL_ON_ERROR_ABORT);
@@ -438,7 +381,7 @@ graphite_transform_loops (void)
location_t loc = find_loop_location
(scops[i]->scop_info->region.entry->dest->loop_father);
- need_cfg_cleanup_p = true;
+ changed = true;
if (!graphite_regenerate_ast_isl (scop))
dump_printf_loc (MSG_MISSED_OPTIMIZATION, loc,
"loop nest not optimized, code generation error\n");
@@ -447,6 +390,16 @@ graphite_transform_loops (void)
"loop nest optimized\n");
}
+ if (changed)
+ {
+ mark_virtual_operands_for_renaming (cfun);
+ update_ssa (TODO_update_ssa);
+ checking_verify_ssa (true, true);
+ rewrite_into_loop_closed_ssa (NULL, 0);
+ scev_reset ();
+ checking_verify_loop_structure ();
+ }
+
if (dump_file && (dump_flags & TDF_DETAILS))
{
loop_p loop;
@@ -461,9 +414,17 @@ graphite_transform_loops (void)
}
free_scops (scops);
- graphite_finalize (need_cfg_cleanup_p);
the_isl_ctx = NULL;
isl_ctx_free (ctx);
+
+ if (changed)
+ {
+ cleanup_tree_cfg ();
+ profile_status_for_fn (cfun) = PROFILE_ABSENT;
+ release_recorded_exits (cfun);
+ tree_estimate_probability (false);
+ }
+
}
#else /* If isl is not available: #ifndef HAVE_isl. */