From 2dd1f944547eb6560c3e15a4b705ae1ac236df75 Mon Sep 17 00:00:00 2001 From: Andrew MacLeod Date: Fri, 29 Jan 2021 09:23:48 -0500 Subject: tree-optimization/98866 - Compile time hog in VRP Don't track [1, +INF] for pointer types, treat them as invariant for caching purposes as they cannot be further refined without evaluating to UNDEFINED. PR tree-optimization/98866 * gimple-range-gori.h (gori_compute:set_range_invariant): New. * gimple-range-gori.cc (gori_map::set_range_invariant): New. (gori_map::m_maybe_invariant): Rename from all_outgoing. (gori_map::gori_map): Rename all_outgoing to m_maybe_invariant. (gori_map::is_export_p): Ditto. (gori_map::calculate_gori): Ditto. (gori_compute::set_range_invariant): New. * gimple-range.cc (gimple_ranger::range_of_stmt): Set range invariant for pointers evaluating to [1, +INF]. --- gcc/gimple-range.cc | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'gcc/gimple-range.cc') diff --git a/gcc/gimple-range.cc b/gcc/gimple-range.cc index 029aaa5..6158a75 100644 --- a/gcc/gimple-range.cc +++ b/gcc/gimple-range.cc @@ -1072,6 +1072,12 @@ gimple_ranger::range_of_stmt (irange &r, gimple *s, tree name) // can sometimes get different results. See PR 97741. r.intersect (tmp); m_cache.set_global_range (name, r); + + // Pointers which resolve to non-zero at the defintion point do not need + // tracking in the cache as they will never change. See PR 98866. + if (POINTER_TYPE_P (TREE_TYPE (name)) && r.nonzero_p ()) + m_cache.set_range_invariant (name); + return true; } -- cgit v1.1