From f824e18c061f9ffa8c49275ba072c120a5b7cdba Mon Sep 17 00:00:00 2001 From: Aldy Hernandez Date: Tue, 13 Nov 2018 15:46:46 +0000 Subject: [PATCH] tree-vrp.c (value_range_base::dump): Dump type. * tree-vrp.c (value_range_base::dump): Dump type. Do not use INF nomenclature for 1-bit types. (dump_value_range): Group all variants to common dumping code. (debug): New overloaded functions for value_ranges. (value_range_base::dump): Remove no argument version. (value_range::dump): Same. testsuite/ * gcc.dg/tree-ssa/pr64130.c: Adjust for new value_range pretty printer. * gcc.dg/tree-ssa/vrp92.c: Same. From-SVN: r266077 --- gcc/ChangeLog | 9 +++ gcc/testsuite/ChangeLog | 6 ++ gcc/testsuite/gcc.dg/tree-ssa/pr64130.c | 4 +- gcc/testsuite/gcc.dg/tree-ssa/vrp92.c | 2 +- gcc/tree-vrp.c | 98 ++++++++++++++++----------------- gcc/tree-vrp.h | 3 - 6 files changed, 64 insertions(+), 58 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f9b23f9..670b162 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2018-11-13 Aldy Hernandez + + * tree-vrp.c (value_range_base::dump): Dump type. + Do not use INF nomenclature for 1-bit types. + (dump_value_range): Group all variants to common dumping code. + (debug): New overloaded functions for value_ranges. + (value_range_base::dump): Remove no argument version. + (value_range::dump): Same. + 2018-11-13 Richard Biener PR tree-optimization/87931 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e61f978..979f597 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2018-11-12 Aldy Hernandez + + * gcc.dg/tree-ssa/pr64130.c: Adjust for new value_range pretty + printer. + * gcc.dg/tree-ssa/vrp92.c: Same. + 2018-11-13 Richard Biener PR tree-optimization/87931 diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr64130.c b/gcc/testsuite/gcc.dg/tree-ssa/pr64130.c index e068765..28ffbb7 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/pr64130.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr64130.c @@ -15,6 +15,6 @@ int funsigned2 (uint32_t a) return (-1 * 0x1ffffffffL) / a == 0; } -/* { dg-final { scan-tree-dump ": \\\[2, 8589934591\\\]" "evrp" } } */ -/* { dg-final { scan-tree-dump ": \\\[-8589934591, -2\\\]" "evrp" } } */ +/* { dg-final { scan-tree-dump "int \\\[2, 8589934591\\\]" "evrp" } } */ +/* { dg-final { scan-tree-dump "int \\\[-8589934591, -2\\\]" "evrp" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp92.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp92.c index 5a2dbf0..66d74e9 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/vrp92.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp92.c @@ -18,5 +18,5 @@ int foo (int i, int j) return j; } -/* { dg-final { scan-tree-dump "res_.: \\\[1, 1\\\]" "vrp1" } } */ +/* { dg-final { scan-tree-dump "res_.: int \\\[1, 1\\\]" "vrp1" } } */ /* { dg-final { scan-tree-dump-not "Threaded" "vrp1" } } */ diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c index 27bc176..f498386 100644 --- a/gcc/tree-vrp.c +++ b/gcc/tree-vrp.c @@ -365,8 +365,6 @@ value_range_base::type () const return TREE_TYPE (min ()); } -/* Dump value range to FILE. */ - void value_range_base::dump (FILE *file) const { @@ -374,21 +372,26 @@ value_range_base::dump (FILE *file) const fprintf (file, "UNDEFINED"); else if (m_kind == VR_RANGE || m_kind == VR_ANTI_RANGE) { - tree type = TREE_TYPE (min ()); + tree ttype = type (); + + print_generic_expr (file, ttype); + fprintf (file, " "); fprintf (file, "%s[", (m_kind == VR_ANTI_RANGE) ? "~" : ""); - if (INTEGRAL_TYPE_P (type) - && !TYPE_UNSIGNED (type) - && vrp_val_is_min (min ())) + if (INTEGRAL_TYPE_P (ttype) + && !TYPE_UNSIGNED (ttype) + && vrp_val_is_min (min ()) + && TYPE_PRECISION (ttype) != 1) fprintf (file, "-INF"); else print_generic_expr (file, min ()); fprintf (file, ", "); - if (INTEGRAL_TYPE_P (type) - && vrp_val_is_max (max ())) + if (INTEGRAL_TYPE_P (ttype) + && vrp_val_is_max (max ()) + && TYPE_PRECISION (ttype) != 1) fprintf (file, "+INF"); else print_generic_expr (file, max ()); @@ -398,7 +401,7 @@ value_range_base::dump (FILE *file) const else if (varying_p ()) fprintf (file, "VARYING"); else - fprintf (file, "INVALID RANGE"); + gcc_unreachable (); } void @@ -425,17 +428,45 @@ value_range::dump (FILE *file) const } void -value_range_base::dump () const +dump_value_range (FILE *file, const value_range *vr) { - dump_value_range (stderr, this); - fprintf (stderr, "\n"); + if (!vr) + fprintf (file, "[]"); + else + vr->dump (file); } void -value_range::dump () const +dump_value_range (FILE *file, const value_range_base *vr) +{ + if (!vr) + fprintf (file, "[]"); + else + vr->dump (file); +} + +DEBUG_FUNCTION void +debug (const value_range_base *vr) +{ + dump_value_range (stderr, vr); +} + +DEBUG_FUNCTION void +debug (const value_range_base &vr) +{ + dump_value_range (stderr, &vr); +} + +DEBUG_FUNCTION void +debug (const value_range *vr) +{ + dump_value_range (stderr, vr); +} + +DEBUG_FUNCTION void +debug (const value_range &vr) { - dump_value_range (stderr, this); - fprintf (stderr, "\n"); + dump_value_range (stderr, &vr); } /* Return true if the SSA name NAME is live on the edge E. */ @@ -2165,43 +2196,6 @@ extract_range_from_unary_expr (value_range_base *vr, return; } -/* Debugging dumps. */ - -void -dump_value_range (FILE *file, const value_range *vr) -{ - if (!vr) - fprintf (file, "[]"); - else - vr->dump (file); -} - -void -dump_value_range (FILE *file, const value_range_base *vr) -{ - if (!vr) - fprintf (file, "[]"); - else - vr->dump (file); -} - -/* Dump value range VR to stderr. */ - -DEBUG_FUNCTION void -debug_value_range (const value_range_base *vr) -{ - dump_value_range (stderr, vr); -} - -/* Dump value range VR to stderr. */ - -DEBUG_FUNCTION void -debug_value_range (const value_range *vr) -{ - dump_value_range (stderr, vr); -} - - /* Given a COND_EXPR COND of the form 'V OP W', and an SSA name V, create a new SSA name N and return the assertion assignment 'N = ASSERT_EXPR '. */ diff --git a/gcc/tree-vrp.h b/gcc/tree-vrp.h index 348fa4f..2878603 100644 --- a/gcc/tree-vrp.h +++ b/gcc/tree-vrp.h @@ -71,9 +71,7 @@ public: void set_and_canonicalize (enum value_range_kind, tree, tree); bool zero_p () const; bool singleton_p (tree *result = NULL) const; - void dump (FILE *) const; - void dump () const; protected: void check (); @@ -139,7 +137,6 @@ class GTY((user)) value_range : public value_range_base void deep_copy (const value_range *); void set_and_canonicalize (enum value_range_kind, tree, tree, bitmap = NULL); void dump (FILE *) const; - void dump () const; private: /* Deep-copies bitmap argument. */ -- 2.7.4