From: Aditya Kumar Date: Wed, 21 Oct 2015 18:53:35 +0000 (+0000) Subject: avoid generation of empty guards in trivial cases X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=77ec8b8c0f75a5f0b953e5dd6696e6b07253f21b;p=gcc.git avoid generation of empty guards in trivial cases We used to insert a trivial integer_onep condition around loops we know have more than an iteration. This patch avoids generating those conditions. * graphite-isl-ast-to-gimple.c (graphite_create_new_loop_guard): Do not call create_empty_if_region_on_edge when cond_expr is true. (translate_isl_ast_node_for): Check whether a guard has been generated. Co-Authored-By: Sebastian Pop From-SVN: r229137 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8b4735d4626..1bad16db4b1 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2015-10-21 Aditya Kumar + Sebastian Pop + + * graphite-isl-ast-to-gimple.c (graphite_create_new_loop_guard): Do not call + create_empty_if_region_on_edge when cond_expr is true. + (translate_isl_ast_node_for): Check whether a guard has been generated. + 2015-10-21 Aditya Kumar * graphite-poly.h (struct dr_info): Added invalid_alias_set number. diff --git a/gcc/graphite-isl-ast-to-gimple.c b/gcc/graphite-isl-ast-to-gimple.c index 7f99bce8c1f..de2847743e1 100644 --- a/gcc/graphite-isl-ast-to-gimple.c +++ b/gcc/graphite-isl-ast-to-gimple.c @@ -707,7 +707,10 @@ graphite_create_new_loop_guard (edge entry_edge, cond_expr = fold_build2 (LT_EXPR, boolean_type_node, *lb, ub_one); } - exit_edge = create_empty_if_region_on_edge (entry_edge, cond_expr); + if (integer_onep (cond_expr)) + exit_edge = entry_edge; + else + exit_edge = create_empty_if_region_on_edge (entry_edge, cond_expr); return exit_edge; } @@ -723,10 +726,14 @@ translate_isl_ast_node_for (loop_p context_loop, __isl_keep isl_ast_node *node, tree type, lb, ub; edge last_e = graphite_create_new_loop_guard (next_e, node, &type, &lb, &ub, ip); - edge true_e = get_true_edge_from_guard_bb (next_e->dest); - translate_isl_ast_for_loop (context_loop, node, true_e, - type, lb, ub, ip); + if (last_e == next_e) + /* There was no guard generated. */ + return translate_isl_ast_for_loop (context_loop, node, last_e, + type, lb, ub, ip); + + edge true_e = get_true_edge_from_guard_bb (next_e->dest); + translate_isl_ast_for_loop (context_loop, node, true_e, type, lb, ub, ip); return last_e; }