From: Aldy Hernandez <aldyh@redhat.com>
To: GCC patches <gcc-patches@gcc.gnu.org>
Cc: Andrew MacLeod <amacleod@redhat.com>, Aldy Hernandez <aldyh@redhat.com>
Subject: [COMMITTED] Replace ad-hoc value_range dumpers with irange::dump.
Date: Wed, 26 Apr 2023 13:47:47 +0200 [thread overview]
Message-ID: <20230426114752.336928-2-aldyh@redhat.com> (raw)
In-Reply-To: <20230426114752.336928-1-aldyh@redhat.com>
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.
---
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 ())
{
--
2.40.0
next prev parent reply other threads:[~2023-04-26 11:48 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-26 11:47 [COMMITTED] Fix swapping of ranges Aldy Hernandez
2023-04-26 11:47 ` Aldy Hernandez [this message]
2023-04-26 11:47 ` [COMMITTED] Remove some uses of deprecated irange API Aldy Hernandez
2023-04-26 11:47 ` [COMMITTED] Convert compare_nonzero_chars to wide_ints Aldy Hernandez
2023-04-26 11:47 ` [COMMITTED] Remove range_int_cst_p Aldy Hernandez
2023-04-26 11:47 ` [COMMITTED] Remove range_has_numeric_bounds_p Aldy Hernandez
2023-04-26 11:47 ` [COMMITTED] Remove legacy range support Aldy Hernandez
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230426114752.336928-2-aldyh@redhat.com \
--to=aldyh@redhat.com \
--cc=amacleod@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).