Commit f824e18c by Aldy Hernandez Committed by Aldy Hernandez

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
parent 7f9414c1
2018-11-13 Aldy Hernandez <aldyh@redhat.com>
* 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 <rguenther@suse.de> 2018-11-13 Richard Biener <rguenther@suse.de>
PR tree-optimization/87931 PR tree-optimization/87931
2018-11-12 Aldy Hernandez <aldyh@redhat.com>
* 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 <rguenther@suse.de> 2018-11-13 Richard Biener <rguenther@suse.de>
PR tree-optimization/87931 PR tree-optimization/87931
......
...@@ -15,6 +15,6 @@ int funsigned2 (uint32_t a) ...@@ -15,6 +15,6 @@ int funsigned2 (uint32_t a)
return (-1 * 0x1ffffffffL) / a == 0; return (-1 * 0x1ffffffffL) / a == 0;
} }
/* { dg-final { scan-tree-dump ": \\\[2, 8589934591\\\]" "evrp" } } */ /* { dg-final { scan-tree-dump "int \\\[2, 8589934591\\\]" "evrp" } } */
/* { dg-final { scan-tree-dump ": \\\[-8589934591, -2\\\]" "evrp" } } */ /* { dg-final { scan-tree-dump "int \\\[-8589934591, -2\\\]" "evrp" } } */
...@@ -18,5 +18,5 @@ int foo (int i, int j) ...@@ -18,5 +18,5 @@ int foo (int i, int j)
return 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" } } */ /* { dg-final { scan-tree-dump-not "Threaded" "vrp1" } } */
...@@ -365,8 +365,6 @@ value_range_base::type () const ...@@ -365,8 +365,6 @@ value_range_base::type () const
return TREE_TYPE (min ()); return TREE_TYPE (min ());
} }
/* Dump value range to FILE. */
void void
value_range_base::dump (FILE *file) const value_range_base::dump (FILE *file) const
{ {
...@@ -374,21 +372,26 @@ value_range_base::dump (FILE *file) const ...@@ -374,21 +372,26 @@ value_range_base::dump (FILE *file) const
fprintf (file, "UNDEFINED"); fprintf (file, "UNDEFINED");
else if (m_kind == VR_RANGE || m_kind == VR_ANTI_RANGE) 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) ? "~" : ""); fprintf (file, "%s[", (m_kind == VR_ANTI_RANGE) ? "~" : "");
if (INTEGRAL_TYPE_P (type) if (INTEGRAL_TYPE_P (ttype)
&& !TYPE_UNSIGNED (type) && !TYPE_UNSIGNED (ttype)
&& vrp_val_is_min (min ())) && vrp_val_is_min (min ())
&& TYPE_PRECISION (ttype) != 1)
fprintf (file, "-INF"); fprintf (file, "-INF");
else else
print_generic_expr (file, min ()); print_generic_expr (file, min ());
fprintf (file, ", "); fprintf (file, ", ");
if (INTEGRAL_TYPE_P (type) if (INTEGRAL_TYPE_P (ttype)
&& vrp_val_is_max (max ())) && vrp_val_is_max (max ())
&& TYPE_PRECISION (ttype) != 1)
fprintf (file, "+INF"); fprintf (file, "+INF");
else else
print_generic_expr (file, max ()); print_generic_expr (file, max ());
...@@ -398,7 +401,7 @@ value_range_base::dump (FILE *file) const ...@@ -398,7 +401,7 @@ value_range_base::dump (FILE *file) const
else if (varying_p ()) else if (varying_p ())
fprintf (file, "VARYING"); fprintf (file, "VARYING");
else else
fprintf (file, "INVALID RANGE"); gcc_unreachable ();
} }
void void
...@@ -425,17 +428,45 @@ value_range::dump (FILE *file) const ...@@ -425,17 +428,45 @@ value_range::dump (FILE *file) const
} }
void void
value_range_base::dump () const dump_value_range (FILE *file, const value_range *vr)
{ {
dump_value_range (stderr, this); if (!vr)
fprintf (stderr, "\n"); fprintf (file, "[]");
else
vr->dump (file);
} }
void 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); dump_value_range (stderr, &vr);
fprintf (stderr, "\n");
} }
/* Return true if the SSA name NAME is live on the edge E. */ /* 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, ...@@ -2165,43 +2196,6 @@ extract_range_from_unary_expr (value_range_base *vr,
return; 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, /* 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 create a new SSA name N and return the assertion assignment
'N = ASSERT_EXPR <V, V OP W>'. */ 'N = ASSERT_EXPR <V, V OP W>'. */
......
...@@ -71,9 +71,7 @@ public: ...@@ -71,9 +71,7 @@ public:
void set_and_canonicalize (enum value_range_kind, tree, tree); void set_and_canonicalize (enum value_range_kind, tree, tree);
bool zero_p () const; bool zero_p () const;
bool singleton_p (tree *result = NULL) const; bool singleton_p (tree *result = NULL) const;
void dump (FILE *) const; void dump (FILE *) const;
void dump () const;
protected: protected:
void check (); void check ();
...@@ -139,7 +137,6 @@ class GTY((user)) value_range : public value_range_base ...@@ -139,7 +137,6 @@ class GTY((user)) value_range : public value_range_base
void deep_copy (const value_range *); void deep_copy (const value_range *);
void set_and_canonicalize (enum value_range_kind, tree, tree, bitmap = NULL); void set_and_canonicalize (enum value_range_kind, tree, tree, bitmap = NULL);
void dump (FILE *) const; void dump (FILE *) const;
void dump () const;
private: private:
/* Deep-copies bitmap argument. */ /* Deep-copies bitmap argument. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment