@@ -3286,9 +3286,8 @@ gimple_cond_code (const_gimple gs)
/* Set CODE to be the predicate code for the conditional statement GS. */
static inline void
-gimple_cond_set_code (gimple gs, enum tree_code code)
+gimple_cond_set_code (gimple_cond gs, enum tree_code code)
{
- GIMPLE_CHECK (gs, GIMPLE_COND);
gs->subcode = code;
}
@@ -1406,9 +1406,12 @@ expand_complex_comparison (gimple_stmt_iterator *gsi, tree ar, tree ai,
break;
case GIMPLE_COND:
- gimple_cond_set_code (stmt, EQ_EXPR);
- gimple_cond_set_lhs (stmt, cc);
- gimple_cond_set_rhs (stmt, boolean_true_node);
+ {
+ gimple_cond cond_stmt = stmt->as_a_gimple_cond ();
+ gimple_cond_set_code (cond_stmt, EQ_EXPR);
+ gimple_cond_set_lhs (cond_stmt, cc);
+ gimple_cond_set_rhs (cond_stmt, boolean_true_node);
+ }
break;
default:
@@ -88,7 +88,7 @@ create_canonical_iv (struct loop *loop, edge exit, tree niter)
{
edge in;
tree type, var;
- gimple cond;
+ gimple_cond cond;
gimple_stmt_iterator incr_at;
enum tree_code cmp;
@@ -99,7 +99,7 @@ create_canonical_iv (struct loop *loop, edge exit, tree niter)
fprintf (dump_file, " iterations.\n");
}
- cond = last_stmt (exit->src);
+ cond = last_stmt (exit->src)->as_a_gimple_cond ();
in = EDGE_SUCC (exit->src, 0);
if (in == exit)
in = EDGE_SUCC (exit->src, 1);
@@ -6477,9 +6477,10 @@ rewrite_use_compare (struct ivopts_data *data,
loop_preheader_edge (data->current_loop),
stmts);
- gimple_cond_set_lhs (use->stmt, var);
- gimple_cond_set_code (use->stmt, compare);
- gimple_cond_set_rhs (use->stmt, op);
+ gimple_cond cond_stmt = use->stmt->as_a_gimple_cond ();
+ gimple_cond_set_lhs (cond_stmt, var);
+ gimple_cond_set_code (cond_stmt, compare);
+ gimple_cond_set_rhs (cond_stmt, op);
return;
}
@@ -1031,7 +1031,7 @@ tree_transform_and_unroll_loop (struct loop *loop, unsigned factor,
transform_callback transform,
void *data)
{
- gimple exit_if;
+ gimple_cond exit_if;
tree ctr_before, ctr_after;
tree enter_main_cond, exit_base, exit_step, exit_bound;
enum tree_code exit_cmp;
@@ -1228,7 +1228,7 @@ tree_transform_and_unroll_loop (struct loop *loop, unsigned factor,
/* Finally create the new counter for number of iterations and add the new
exit instruction. */
bsi = gsi_last_nondebug_bb (exit_bb);
- exit_if = gsi_stmt (bsi);
+ exit_if = gsi_stmt (bsi)->as_a_gimple_cond ();
create_iv (exit_base, exit_step, NULL_TREE, loop,
&bsi, false, &ctr_before, &ctr_after);
gimple_cond_set_code (exit_if, exit_cmp);
@@ -1339,7 +1339,7 @@ canonicalize_loop_ivs (struct loop *loop, tree *nit, bool bump_in_latch)
tree type, var_before;
gimple_stmt_iterator gsi;
gimple_phi_iterator psi;
- gimple stmt;
+ gimple_cond stmt;
edge exit = single_dom_exit (loop);
gimple_seq stmts;
enum machine_mode mode;
@@ -1390,7 +1390,7 @@ canonicalize_loop_ivs (struct loop *loop, tree *nit, bool bump_in_latch)
rewrite_all_phi_nodes_with_iv (loop, var_before);
- stmt = last_stmt (exit->src);
+ stmt = last_stmt (exit->src)->as_a_gimple_cond ();
/* Make the loop exit if the control condition is not satisfied. */
if (exit->flags & EDGE_TRUE_VALUE)
{
@@ -1431,14 +1431,14 @@ propagate_tree_value_into_stmt (gimple_stmt_iterator *gsi, tree val)
propagate_tree_value (&expr, val);
gimple_assign_set_rhs_from_tree (gsi, expr);
}
- else if (gimple_code (stmt) == GIMPLE_COND)
+ else if (gimple_cond cond_stmt = stmt->dyn_cast_gimple_cond ())
{
tree lhs = NULL_TREE;
tree rhs = build_zero_cst (TREE_TYPE (val));
propagate_tree_value (&lhs, val);
- gimple_cond_set_code (stmt, NE_EXPR);
- gimple_cond_set_lhs (stmt, lhs);
- gimple_cond_set_rhs (stmt, rhs);
+ gimple_cond_set_code (cond_stmt, NE_EXPR);
+ gimple_cond_set_lhs (cond_stmt, lhs);
+ gimple_cond_set_rhs (cond_stmt, rhs);
}
else if (is_gimple_call (stmt)
&& gimple_call_lhs (stmt) != NULL_TREE)