We have a way of dumping the asserts in the asserts_for on-the-side
structure, but we have no way of dumping the assert_info structure that
evrp uses. Being able to dump these are quite useful in debugging.
Committed as obvious.
commit 9244efff3f7ccce390c70c83d9fc46cef6152bb4
Author: Aldy Hernandez <al...@redhat.com>
Date: Mon Nov 4 12:14:56 2019 +0100
Implement debugging functions for assert_info's.
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index f29939a0dd8..d00348891bd 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2019-11-04 Aldy Hernandez <al...@redhat.com>
+
+ * tree-vrp.c (dump_assert_info): New.
+ (dump_asserts_info): New.
+
2019-11-04 Tamar Christina <tamar.christ...@arm.com>
* tree-vect-slp.c (vectorize_slp_instance_root_stmt): Initialize rstmt.
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index da6b6151b4a..7c35802dacc 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -2114,6 +2114,45 @@ debug_all_asserts (void)
dump_all_asserts (stderr);
}
+/* Dump assert_info structure. */
+
+void
+dump_assert_info (FILE *file, const assert_info &assert)
+{
+ fprintf (file, "Assert for: ");
+ print_generic_expr (file, assert.name);
+ fprintf (file, "\n\tPREDICATE: expr=[");
+ print_generic_expr (file, assert.expr);
+ fprintf (file, "] %s ", get_tree_code_name (assert.comp_code));
+ fprintf (file, "val=[");
+ print_generic_expr (file, assert.val);
+ fprintf (file, "]\n\n");
+}
+
+DEBUG_FUNCTION void
+debug (const assert_info &assert)
+{
+ dump_assert_info (stderr, assert);
+}
+
+/* Dump a vector of assert_info's. */
+
+void
+dump_asserts_info (FILE *file, const vec<assert_info> &asserts)
+{
+ for (unsigned i = 0; i < asserts.length (); ++i)
+ {
+ dump_assert_info (file, asserts[i]);
+ fprintf (file, "\n");
+ }
+}
+
+DEBUG_FUNCTION void
+debug (const vec<assert_info> &asserts)
+{
+ dump_asserts_info (stderr, asserts);
+}
+
/* Push the assert info for NAME, EXPR, COMP_CODE and VAL to ASSERTS. */
static void