aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimple-range.cc
diff options
context:
space:
mode:
authorAndrew MacLeod <amacleod@redhat.com>2022-02-16 19:59:34 -0500
committerAndrew MacLeod <amacleod@redhat.com>2022-05-13 09:57:03 -0400
commitaf34279921f4bb95b07c0be7fce9baeffafcb53d (patch)
tree0b08ab1d4fb5de1f669c4c7eadf02d3170a324b0 /gcc/gimple-range.cc
parent602a3161f425ee3fe325413eeab9792e8e07a2ff (diff)
downloadgcc-af34279921f4bb95b07c0be7fce9baeffafcb53d.zip
gcc-af34279921f4bb95b07c0be7fce9baeffafcb53d.tar.gz
gcc-af34279921f4bb95b07c0be7fce9baeffafcb53d.tar.bz2
Export global ranges during the VRP block walk.
VRP currently searches the ssa_name list for globals to exported after it finishes running. Recent changes have VRP calling a side-effect routine for each stmt during the walk. This change simply exports globals as they are calculated the final time during the walk. * gimple-range.cc (gimple_ranger::register_side_effects): First check if the DEF should be exported as a global. * tree-vrp.cc (rvrp_folder::pre_fold_bb): Process PHI side effects, which will export globals. (execute_ranger_vrp): Remove call to export_global_ranges.
Diffstat (limited to 'gcc/gimple-range.cc')
-rw-r--r--gcc/gimple-range.cc22
1 files changed, 22 insertions, 0 deletions
diff --git a/gcc/gimple-range.cc b/gcc/gimple-range.cc
index f0caefc..1fdee02 100644
--- a/gcc/gimple-range.cc
+++ b/gcc/gimple-range.cc
@@ -458,6 +458,28 @@ gimple_ranger::fold_stmt (gimple_stmt_iterator *gsi, tree (*valueize) (tree))
void
gimple_ranger::register_side_effects (gimple *s)
{
+ // First, export the LHS if it is a new global range.
+ tree lhs = gimple_get_lhs (s);
+ if (lhs)
+ {
+ int_range_max tmp;
+ if (range_of_stmt (tmp, s, lhs) && !tmp.varying_p ()
+ && update_global_range (tmp, lhs) && dump_file)
+ {
+ value_range vr = tmp;
+ fprintf (dump_file, "Global Exported: ");
+ print_generic_expr (dump_file, lhs, TDF_SLIM);
+ fprintf (dump_file, " = ");
+ vr.dump (dump_file);
+ int_range_max same = vr;
+ if (same != tmp)
+ {
+ fprintf (dump_file, " ... irange was : ");
+ tmp.dump (dump_file);
+ }
+ fputc ('\n', dump_file);
+ }
+ }
m_cache.block_apply_nonnull (s);
}