+2021-11-16 Frederik Harwath <frederik@codesourcery.com>
+
+ * graphite-scop-detection.cc (scop_context_loop): New function.
+ (build_alias_set): Use scop_context_loop instead of find_common_loop.
+ * graphite-isl-ast-to-gimple.cc (graphite_regenerate_ast_isl): Likewise.
+ * graphite.h (scop_context_loop): New declaration.
+
2021-11-16 Frederik Harwath <frederik@codesourcery.com>
* graphite-optimize-isl.cc (optimize_isl): Adjust
conditional if aliasing can be ruled out at runtime and the original
version of the SCoP, otherwise. */
- loop_p loop
- = find_common_loop (scop->scop_info->region.entry->dest->loop_father,
- scop->scop_info->region.exit->src->loop_father);
+ loop_p loop = scop_context_loop (scop);
tree cond = generate_alias_cond (scop->unhandled_alias_ddrs, loop);
tree non_alias_cond = build1 (TRUTH_NOT_EXPR, boolean_type_node, cond);
set_ifsese_condition (region->if_region, non_alias_cond);
return NULL;
}
+
+/* Return the innermost loop that encloses all loops in SCOP. */
+
+loop_p
+scop_context_loop (scop_p scop)
+{
+ edge scop_entry = scop->scop_info->region.entry;
+ edge scop_exit = scop->scop_info->region.exit;
+ basic_block exit_bb = scop_exit->src;
+
+ while (sese_trivially_empty_bb_p (exit_bb) && single_pred_p (exit_bb))
+ exit_bb = single_pred (exit_bb);
+
+ loop_p entry_loop = scop_entry->dest->loop_father;
+ return find_common_loop (entry_loop, exit_bb->loop_father);
+}
+
namespace
{
int i, j;
int *all_vertices;
- struct loop *nest
- = find_common_loop (scop->scop_info->region.entry->dest->loop_father,
- scop->scop_info->region.exit->src->loop_father);
+ struct loop *nest = scop_context_loop (scop);
gcc_checking_assert (nest);
extern void dot_all_sese (FILE *, vec<sese_l> &);
extern void dot_sese (sese_l &);
extern void dot_cfg ();
+extern loop_p scop_context_loop (scop_p);
#endif