From 41a98cf507b96d9c64eed7c0f3b4daec5357e5a3 Mon Sep 17 00:00:00 2001 From: Andrew MacLeod Date: Mon, 17 Oct 2022 12:28:21 -0400 Subject: [PATCH 3/3] Show output in assume pass --- gcc/tree-vrp.cc | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/gcc/tree-vrp.cc b/gcc/tree-vrp.cc index 1adb15c9934..b7c59cfa057 100644 --- a/gcc/tree-vrp.cc +++ b/gcc/tree-vrp.cc @@ -50,6 +50,7 @@ along with GCC; see the file COPYING3. If not see #include "gimple-range-path.h" #include "value-pointer-equiv.h" #include "gimple-fold.h" +#include "tree-dfa.h" /* Set of SSA names found live during the RPO traversal of the function for still active basic-blocks. */ @@ -4465,6 +4466,36 @@ public: bool gate (function *fun) final override { return fun->assume_function; } unsigned int execute (function *) final override { + assume_query query; + if (dump_file) + fprintf (dump_file, "Assumptions :\n--------------\n"); + + for (tree arg = DECL_ARGUMENTS (cfun->decl); arg; arg = DECL_CHAIN (arg)) + { + tree name = ssa_default_def (cfun, arg); + if (!name || !gimple_range_ssa_p (name)) + continue; + tree type = TREE_TYPE (name); + if (!Value_Range::supports_type_p (type)) + continue; + Value_Range assume_range (type); + if (query.assume_range_p (assume_range, name)) + { + set_range_info (name, assume_range); + if (dump_file) + { + print_generic_expr (dump_file, name, TDF_SLIM); + fprintf (dump_file, " -> "); + assume_range.dump (dump_file); + fputc ('\n', dump_file); + } + } + } + if (dump_file) + { + fputc ('\n', dump_file); + gimple_dump_cfg (dump_file, dump_flags); + } return TODO_discard_function; } -- 2.37.3