+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.
+
2017-10-13 Richard Biener <rguenther@suse.de>
* graphite-isl-ast-to-gimple.c (max_mode_int_precision,
__isl_give isl_ast_node * scop_to_isl_ast (scop_p scop);
tree get_rename_from_scev (tree old_name, gimple_seq *stmts, loop_p loop,
- basic_block new_bb, basic_block old_bb,
vec<tree> iv_map);
bool graphite_copy_stmts_from_block (basic_block bb, basic_block new_bb,
vec<tree> iv_map);
tree translate_isl_ast_to_gimple::
get_rename_from_scev (tree old_name, gimple_seq *stmts, loop_p loop,
- basic_block new_bb, basic_block,
vec<tree> iv_map)
{
tree scev = scalar_evolution_in_region (region->region, loop, old_name);
return build_zero_cst (TREE_TYPE (old_name));
}
- if (TREE_CODE (new_expr) == SSA_NAME)
- {
- basic_block bb = gimple_bb (SSA_NAME_DEF_STMT (new_expr));
- if (bb && !dominated_by_p (CDI_DOMINATORS, new_bb, bb))
- {
- set_codegen_error ();
- return build_zero_cst (TREE_TYPE (old_name));
- }
- }
-
/* Replace the old_name with the new_expr. */
return force_gimple_operand (unshare_expr (new_expr), stmts,
true, NULL_TREE);
{
gimple_seq stmts = NULL;
new_name = get_rename_from_scev (old_name, &stmts,
- bb->loop_father,
- new_bb, bb, iv_map);
+ bb->loop_father, iv_map);
if (! codegen_error_p ())
gsi_insert_earliest (stmts);
new_expr = &new_name;
gimple_seq stmts = NULL;
tree new_name = get_rename_from_scev (arg, &stmts,
bb->loop_father,
- new_bb, bb, iv_map);
+ iv_map);
if (! codegen_error_p ())
gsi_insert_earliest (stmts);
arg = new_name;
if_region->true_region->region.exit);
if (dump_file)
fprintf (dump_file, "[codegen] isl AST to Gimple succeeded.\n");
-
- mark_virtual_operands_for_renaming (cfun);
- update_ssa (TODO_update_ssa);
- checking_verify_ssa (true, true);
- rewrite_into_loop_closed_ssa (NULL, 0);
- /* We analyzed evolutions of all SCOPs during SCOP detection
- which cached evolutions. Now we've introduced PHIs for
- liveouts which causes those cached solutions to be invalid
- for code-generation purposes given we'd insert references
- to SSA names not dominating their new use. */
- scev_reset ();
}
if (t.codegen_error_p ())
"reverting back to the original code.\n");
set_ifsese_condition (if_region, integer_zero_node);
- /* We registered new names, scrap that. */
- if (need_ssa_update_p (cfun))
- delete_update_ssa ();
/* Remove the unreachable region. */
remove_edge_and_dominated_blocks (if_region->true_region->region.entry);
basic_block ifb = if_region->false_region->region.entry->src;
delete_loop (loop);
}
- /* Verifies properties that GRAPHITE should maintain during translation. */
- checking_verify_loop_structure ();
- checking_verify_loop_closed_ssa (true);
+ /* We are delaying SSA update to after code-generating all SCOPs.
+ This is because we analyzed DRs and parameters on the unmodified
+ IL and thus rely on SSA update to pick up new dominating definitions
+ from for example SESE liveout PHIs. This is also for efficiency
+ as SSA update does work depending on the size of the function. */
free (if_region->true_region);
free (if_region->region);
#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. */
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
{
int i;
scop_p scop;
- bool need_cfg_cleanup_p = false;
+ bool changed = false;
vec<scop_p> scops = vNULL;
isl_ctx *ctx;
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);
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");
"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;
}
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. */
"maximum number of arrays per scop.",
100, 0, 0)
-/* Maximal number of basic blocks in the functions analyzed by Graphite. */
-
-DEFPARAM (PARAM_GRAPHITE_MIN_LOOPS_PER_FUNCTION,
- "graphite-min-loops-per-function",
- "minimal number of loops per function to be analyzed by Graphite.",
- 2, 0, 0)
-
DEFPARAM (PARAM_MAX_ISL_OPERATIONS,
"max-isl-operations",
"maximum number of isl operations, 0 means unlimited",
+2017-10-13 Richard Biener <rguenther@suse.de>
+
+ * gcc.dg/graphite/pr35356-3.c: XFAIL again.
+ * gcc.dg/graphite/pr81373-2.c: Copy from gcc.dg/graphite/pr81373.c
+ with alternate flags.
+
2017-10-13 Richard Biener <rguenther@suse.de>
* gcc.dg/graphite/scop-10.c: Enlarge array to avoid undefined
"Y[winner].y > 0". This could be fixed when we will use predicates
for such cases. */
-/* { dg-final { scan-tree-dump-times "loop_1" 0 "graphite" } } */
+/* { dg-final { scan-tree-dump-times "loop_1" 0 "graphite" { xfail *-*-* } } } */
+/* { dg-final { scan-tree-dump "number of SCoPs: 0" "graphite" } } */