Properly check for pointers instead of just using range_info_get_range.
bootstrapped on 86_64-pc-linux-gnu (and presumably AIX too :-) with no regressions.
On 10/3/23 12:53, David Edelsohn wrote:
AIX bootstrap is happier with the patch. Thanks, David
commit d8808c37d29110872fa51b98e71aef9e160b4692 Author: Andrew MacLeod <amacl...@redhat.com> Date: Tue Oct 3 12:32:10 2023 -0400 Don't use range_info_get_range for pointers. Pointers only track null and nonnull, so we need to handle them specially. * tree-ssanames.cc (set_range_info): Use get_ptr_info for pointers rather than range_info_get_range. diff --git a/gcc/tree-ssanames.cc b/gcc/tree-ssanames.cc index 1eae411ac1c..0a32444fbdf 100644 --- a/gcc/tree-ssanames.cc +++ b/gcc/tree-ssanames.cc @@ -420,15 +420,11 @@ set_range_info (tree name, const vrange &r) // Pick up the current range, or VARYING if none. tree type = TREE_TYPE (name); - Value_Range tmp (type); - if (range_info_p (name)) - range_info_get_range (name, tmp); - else - tmp.set_varying (type); - if (POINTER_TYPE_P (type)) { - if (r.nonzero_p () && !tmp.nonzero_p ()) + struct ptr_info_def *pi = get_ptr_info (name); + // If R is nonnull and pi is not, set nonnull. + if (r.nonzero_p () && (!pi || pi->pt.null)) { set_ptr_nonnull (name); return true; @@ -436,6 +432,11 @@ set_range_info (tree name, const vrange &r) return false; } + Value_Range tmp (type); + if (range_info_p (name)) + range_info_get_range (name, tmp); + else + tmp.set_varying (type); // If the result doesn't change, or is undefined, return false. if (!tmp.intersect (r) || tmp.undefined_p ()) return false;