summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-loop-ivcanon.c
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2013-12-20 12:19:58 -0500
committerDavid Malcolm <dmalcolm@redhat.com>2014-10-24 17:25:16 -0400
commitea8bd2eaa829c9969aa56b117221803ff4d28a5b (patch)
treeeeb50e914306f22fb1352d000b886f5d4ee80240 /gcc/tree-ssa-loop-ivcanon.c
parent7adc5519dccf5bc28755edd0411037a3564f3983 (diff)
downloadgcc-ea8bd2eaa829c9969aa56b117221803ff4d28a5b.tar.gz
Concretize gimple_cond_make_{false|true}
This corresponds to: [PATCH 71/89] Concretize gimple_cond_make_{false|true} https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01208.html from the original 89-patch kit That earlier patch was approved by Jeff: > OK once prerequisites go in. in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00863.html gcc/ * gimple.h (gimple_cond_make_false): Require a gimple_cond. (gimple_cond_make_true): Likewise. * tree-cfg.c (fold_cond_expr_cond): Add a checked cast to gimple_cond within region guarded by check for GIMPLE_COND. * tree-ssa-ccp.c (ccp_fold_stmt): Likewise. * tree-loop-distribution.c (generate_loops_for_partition): Replace a check for GIMPLE_COND with a dyn_cast<gimple_cond>. * tree-ssa-ccp.c (optimize_unreachable): Likewise. * tree-ssa-loop-niter.c (number_of_iterations_exit): Likewise. * tree-ssa-pre.c (eliminate_dom_walker::before_dom_children): Likewise. * tree-vrp.c (fold_predicate_in): Add a checked cast to gimple_cond. We must be dealing with a GIMPLE_COND since logic at top of the function ensures we only act on GIMPLE_ASSIGN and GIMPLE_COND statements, and we're now within a "not a GIMPLE_ASSIGN" clause. * tree-ssa-loop-ivcanon.c (remove_exits_and_undefined_stmts): Add checked cast of elt->stmt to gimple_cond. The existing code requires this to be a GIMPLE_COND, though it's not clear to me how this requirement is enforced. (remove_redundant_iv_tests): Likewise. (try_unroll_loop_completely): Likewise, for the last_stmt of the preceding bb along edge_to_cancel. * tree-ssa-reassoc.c (maybe_optimize_range_tests): Likewise, for the last_stmt of bb.
Diffstat (limited to 'gcc/tree-ssa-loop-ivcanon.c')
-rw-r--r--gcc/tree-ssa-loop-ivcanon.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/gcc/tree-ssa-loop-ivcanon.c b/gcc/tree-ssa-loop-ivcanon.c
index 00cbf8ff538..b70f1182cf5 100644
--- a/gcc/tree-ssa-loop-ivcanon.c
+++ b/gcc/tree-ssa-loop-ivcanon.c
@@ -521,11 +521,12 @@ remove_exits_and_undefined_stmts (struct loop *loop, unsigned int npeeled)
if (!loop_exit_edge_p (loop, exit_edge))
exit_edge = EDGE_SUCC (bb, 1);
gcc_checking_assert (loop_exit_edge_p (loop, exit_edge));
+ gimple_cond cond_stmt = as_a <gimple_cond> (elt->stmt);
if (exit_edge->flags & EDGE_TRUE_VALUE)
- gimple_cond_make_true (elt->stmt);
+ gimple_cond_make_true (cond_stmt);
else
- gimple_cond_make_false (elt->stmt);
- update_stmt (elt->stmt);
+ gimple_cond_make_false (cond_stmt);
+ update_stmt (cond_stmt);
changed = true;
}
}
@@ -574,11 +575,12 @@ remove_redundant_iv_tests (struct loop *loop)
fprintf (dump_file, "Removed pointless exit: ");
print_gimple_stmt (dump_file, elt->stmt, 0, 0);
}
+ gimple_cond cond_stmt = as_a <gimple_cond> (elt->stmt);
if (exit_edge->flags & EDGE_TRUE_VALUE)
- gimple_cond_make_false (elt->stmt);
+ gimple_cond_make_false (cond_stmt);
else
- gimple_cond_make_true (elt->stmt);
- update_stmt (elt->stmt);
+ gimple_cond_make_true (cond_stmt);
+ update_stmt (cond_stmt);
changed = true;
}
}
@@ -658,7 +660,6 @@ try_unroll_loop_completely (struct loop *loop,
location_t locus)
{
unsigned HOST_WIDE_INT n_unroll, ninsns, max_unroll, unr_insns;
- gimple cond;
struct loop_size size;
bool n_unroll_found = false;
edge edge_to_cancel = NULL;
@@ -855,7 +856,7 @@ try_unroll_loop_completely (struct loop *loop,
/* Remove the conditional from the last copy of the loop. */
if (edge_to_cancel)
{
- cond = last_stmt (edge_to_cancel->src);
+ gimple_cond cond = as_a <gimple_cond> (last_stmt (edge_to_cancel->src));
if (edge_to_cancel->flags & EDGE_TRUE_VALUE)
gimple_cond_make_false (cond);
else