static tree
tree_may_unswitch_on (basic_block bb, struct loop *loop)
{
- gimple stmt, def;
+ gimple last, def;
+ gcond *stmt;
tree cond, use;
basic_block def_bb;
ssa_op_iter iter;
/* BB must end in a simple conditional jump. */
- stmt = last_stmt (bb);
- if (!stmt || gimple_code (stmt) != GIMPLE_COND)
+ last = last_stmt (bb);
+ if (!last || gimple_code (last) != GIMPLE_COND)
return NULL_TREE;
+ stmt = as_a <gcond *> (last);
/* To keep the things simple, we do not directly remove the conditions,
but just replace tests with 0 != 0 resp. 1 != 0. Prevent the infinite
if (integer_nonzerop (cond))
{
/* Remove false path. */
- gimple_cond_set_condition_from_tree (stmt, boolean_true_node);
+ gimple_cond_set_condition_from_tree (as_a <gcond *> (stmt),
+ boolean_true_node);
changed = true;
}
else if (integer_zerop (cond))
{
/* Remove true path. */
- gimple_cond_set_condition_from_tree (stmt, boolean_false_node);
+ gimple_cond_set_condition_from_tree (as_a <gcond *> (stmt),
+ boolean_false_node);
changed = true;
}
/* Do not unswitch too much. */
if (stmt
&& gimple_code (stmt) == GIMPLE_COND)
{
- if (gimple_cond_true_p (stmt))
+ gcond *cond_stmt = as_a <gcond *> (stmt);
+ if (gimple_cond_true_p (cond_stmt))
flags = EDGE_FALSE_VALUE;
- else if (gimple_cond_false_p (stmt))
+ else if (gimple_cond_false_p (cond_stmt))
flags = EDGE_TRUE_VALUE;
}
}