public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Aldy Hernandez <aldyh@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r14-256] Replace ad-hoc value_range dumpers with irange::dump. Date: Wed, 26 Apr 2023 11:50:20 +0000 (GMT) [thread overview] Message-ID: <20230426115020.D3F2E3851C24@sourceware.org> (raw) 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 ()) {
reply other threads:[~2023-04-26 11:50 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20230426115020.D3F2E3851C24@sourceware.org \ --to=aldyh@gcc.gnu.org \ --cc=gcc-cvs@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: linkBe 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).