{
/* If op0 already has the range op0 % op1 has,
then TRUNC_MOD_EXPR won't change anything. */
- gimple_stmt_iterator gsi = gsi_for_stmt (stmt);
- gimple_assign_set_rhs_from_tree (&gsi, op0);
- update_stmt (stmt);
+ gimple_assign_set_rhs_from_tree (gsi, op0);
return true;
}
}
disjoint. Return true if we do simplify. */
static bool
-simplify_min_or_max_using_ranges (gimple *stmt)
+simplify_min_or_max_using_ranges (gimple_stmt_iterator *gsi, gimple *stmt)
{
tree op0 = gimple_assign_rhs1 (stmt);
tree op1 = gimple_assign_rhs2 (stmt);
VAL == FALSE -> OP0 > or >= op1. */
tree res = ((gimple_assign_rhs_code (stmt) == MAX_EXPR)
== integer_zerop (val)) ? op0 : op1;
- gimple_stmt_iterator gsi = gsi_for_stmt (stmt);
- gimple_assign_set_rhs_from_tree (&gsi, res);
- update_stmt (stmt);
- fold_stmt (&gsi, follow_single_use_edges);
+ gimple_assign_set_rhs_from_tree (gsi, res);
return true;
}
ABS_EXPR into a NEGATE_EXPR. */
static bool
-simplify_abs_using_ranges (gimple *stmt)
+simplify_abs_using_ranges (gimple_stmt_iterator *gsi, gimple *stmt)
{
tree op = gimple_assign_rhs1 (stmt);
value_range *vr = get_value_range (op);
else
gimple_assign_set_rhs_code (stmt, NEGATE_EXPR);
update_stmt (stmt);
- gimple_stmt_iterator gsi = gsi_for_stmt (stmt);
- fold_stmt (&gsi, follow_single_use_edges);
+ fold_stmt (gsi, follow_single_use_edges);
return true;
}
}
/* Simplify an integral conversion from an SSA name in STMT. */
static bool
-simplify_conversion_using_ranges (gimple *stmt)
+simplify_conversion_using_ranges (gimple_stmt_iterator *gsi, gimple *stmt)
{
tree innerop, middleop, finaltype;
gimple *def_stmt;
return false;
gimple_assign_set_rhs1 (stmt, innerop);
- gimple_stmt_iterator gsi = gsi_for_stmt (stmt);
- fold_stmt (&gsi, follow_single_use_edges);
+ fold_stmt (gsi, follow_single_use_edges);
return true;
}
case ABS_EXPR:
if (TREE_CODE (rhs1) == SSA_NAME
&& INTEGRAL_TYPE_P (TREE_TYPE (rhs1)))
- return simplify_abs_using_ranges (stmt);
+ return simplify_abs_using_ranges (gsi, stmt);
break;
case BIT_AND_EXPR:
CASE_CONVERT:
if (TREE_CODE (rhs1) == SSA_NAME
&& INTEGRAL_TYPE_P (TREE_TYPE (rhs1)))
- return simplify_conversion_using_ranges (stmt);
+ return simplify_conversion_using_ranges (gsi, stmt);
break;
case FLOAT_EXPR:
case MIN_EXPR:
case MAX_EXPR:
- return simplify_min_or_max_using_ranges (stmt);
+ return simplify_min_or_max_using_ranges (gsi, stmt);
default:
break;