Replace ad-hoc value_range dumpers with irange::dump.

This causes a regression in gcc.c-torture/unsorted/dump-noaddr.c.

The test is asserting that two dumps are identical, but they are not
because irange dumps the type which varies between runs:

               <          VR  [irange] void (*<T3dc>) (int) [1, +INF]
               >          VR  [irange] void (*<T3da>) (int) [1, +INF]

I have changed the pretty printer for irange types to pass TDF_NOUID,
thus avoiding this problem.

gcc/ChangeLog:

	* ipa-prop.cc (ipa_print_node_jump_functions_for_edge): Use
	vrange::dump instead of ad-hoc dumper.
	* tree-ssa-strlen.cc (dump_strlen_info): Same.
	* value-range-pretty-print.cc (visit): Pass TDF_NOUID to
	dump_generic_node.
This commit is contained in:
Aldy Hernandez 2023-01-19 18:42:30 +01:00
parent 04e5ddf8a3
commit 1a8087c7d1
3 changed files with 9 additions and 42 deletions

View file

@ -437,13 +437,8 @@ ipa_print_node_jump_functions_for_edge (FILE *f, struct cgraph_edge *cs)
if (jump_func->m_vr)
{
fprintf (f, " VR ");
fprintf (f, "%s[",
(jump_func->m_vr->kind () == VR_ANTI_RANGE) ? "~" : "");
print_decs (wi::to_wide (jump_func->m_vr->min ()), f);
fprintf (f, ", ");
print_decs (wi::to_wide (jump_func->m_vr->max ()), f);
fprintf (f, "]\n");
jump_func->m_vr->dump (f);
fprintf (f, "\n");
}
else
fprintf (f, " Unknown VR\n");

View file

@ -981,42 +981,14 @@ dump_strlen_info (FILE *fp, gimple *stmt, range_query *rvals)
print_generic_expr (fp, si->nonzero_chars);
if (TREE_CODE (si->nonzero_chars) == SSA_NAME)
{
value_range_kind rng = VR_UNDEFINED;
wide_int min, max;
value_range vr;
if (rvals)
{
value_range vr;
rvals->range_of_expr (vr, si->nonzero_chars,
si->stmt);
rng = vr.kind ();
if (range_int_cst_p (&vr))
{
min = wi::to_wide (vr.min ());
max = wi::to_wide (vr.max ());
}
else
rng = VR_UNDEFINED;
}
rvals->range_of_expr (vr, si->nonzero_chars,
si->stmt);
else
{
value_range vr;
get_range_query (cfun)
->range_of_expr (vr, si->nonzero_chars);
rng = vr.kind ();
if (!vr.undefined_p ())
{
min = wi::to_wide (vr.min ());
max = wi::to_wide (vr.max ());
}
}
if (rng == VR_RANGE || rng == VR_ANTI_RANGE)
{
fprintf (fp, " %s[%llu, %llu]",
rng == VR_RANGE ? "" : "~",
(long long) min.to_uhwi (),
(long long) max.to_uhwi ());
}
get_range_query (cfun)->range_of_expr (vr,
si->nonzero_chars);
vr.dump (fp);
}
}

View file

@ -56,7 +56,7 @@ vrange_printer::visit (const irange &r) const
pp_string (pp, "UNDEFINED");
return;
}
dump_generic_node (pp, r.type (), 0, TDF_NONE, false);
dump_generic_node (pp, r.type (), 0, TDF_NONE | TDF_NOUID, false);
pp_character (pp, ' ');
if (r.varying_p ())
{