public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-256] Replace ad-hoc value_range dumpers with irange::dump.
@ 2023-04-26 11:50 Aldy Hernandez
0 siblings, 0 replies; only message in thread
From: Aldy Hernandez @ 2023-04-26 11:50 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:1a8087c7d1cb3ca1daa87a61766923bad0143700
commit r14-256-g1a8087c7d1cb3ca1daa87a61766923bad0143700
Author: Aldy Hernandez <aldyh@redhat.com>
Date: Thu Jan 19 18:42:30 2023 +0100
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.
Diff:
---
gcc/ipa-prop.cc | 9 ++-------
gcc/tree-ssa-strlen.cc | 40 ++++++----------------------------------
gcc/value-range-pretty-print.cc | 2 +-
3 files changed, 9 insertions(+), 42 deletions(-)
diff --git a/gcc/ipa-prop.cc b/gcc/ipa-prop.cc
index 1a8ff7ebb95..c6d4585aed1 100644
--- a/gcc/ipa-prop.cc
+++ b/gcc/ipa-prop.cc
@@ -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");
diff --git a/gcc/tree-ssa-strlen.cc b/gcc/tree-ssa-strlen.cc
index 1d79034594b..dcc9e9e14ab 100644
--- a/gcc/tree-ssa-strlen.cc
+++ b/gcc/tree-ssa-strlen.cc
@@ -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);
}
}
diff --git a/gcc/value-range-pretty-print.cc b/gcc/value-range-pretty-print.cc
index a11c5a621f8..8d47d8087e8 100644
--- a/gcc/value-range-pretty-print.cc
+++ b/gcc/value-range-pretty-print.cc
@@ -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 ())
{
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-04-26 11:50 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-26 11:50 [gcc r14-256] Replace ad-hoc value_range dumpers with irange::dump Aldy Hernandez
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).