value_range *vr = evrp_range_analyzer.get_value_range (lhs);
/* Mark PHIs whose lhs we fully propagate for removal. */
- tree val = value_range_constant_singleton (vr);
- if (val && may_propagate_copy (lhs, val))
+ tree val;
+ if (vr->singleton_p (&val) && may_propagate_copy (lhs, val))
{
stmts_to_remove.safe_push (phi);
continue;
value_range *vr = evrp_range_analyzer.get_value_range (output);
/* Mark stmts whose output we fully propagate for removal. */
- if ((val = value_range_constant_singleton (vr))
+ if (vr->singleton_p (&val)
&& may_propagate_copy (output, val)
&& !stmt_could_throw_p (cfun, stmt)
&& !gimple_has_side_effects (stmt))
/* Try folding stmts with the VR discovered. */
bool did_replace = evrp_folder.replace_uses_in (stmt);
+ gimple_stmt_iterator prev_gsi = gsi;
+ gsi_prev (&prev_gsi);
if (fold_stmt (&gsi, follow_single_use_edges)
|| did_replace)
{
if (did_replace)
{
+ /* If we wound up generating new stmts during folding
+ drop all their defs to VARYING. We can't easily
+ process them because we've already instantiated
+ ranges on uses on STMT that only hold after it. */
+ if (gsi_end_p (prev_gsi))
+ prev_gsi = gsi_start_bb (bb);
+ else
+ gsi_next (&prev_gsi);
+ while (gsi_stmt (prev_gsi) != gsi_stmt (gsi))
+ {
+ evrp_range_analyzer.get_vr_values ()
+ ->set_defs_to_varying (gsi_stmt (prev_gsi));
+ gsi_next (&prev_gsi);
+ }
+
/* If we cleaned up EH information from the statement,
remove EH edges. */
if (maybe_clean_or_replace_eh_stmt (old_stmt, stmt))
|| virtual_operand_p (arg))
continue;
value_range *vr = evrp_range_analyzer.get_value_range (arg);
- tree val = value_range_constant_singleton (vr);
- if (val && may_propagate_copy (arg, val))
+ tree val;
+ if (vr->singleton_p (&val) && may_propagate_copy (arg, val))
propagate_value (use_p, val);
}
}