diff options
author | Andrew MacLeod <amacleod@redhat.com> | 2023-10-03 12:32:10 -0400 |
---|---|---|
committer | Andrew MacLeod <amacleod@redhat.com> | 2023-10-03 17:15:27 -0400 |
commit | d8808c37d29110872fa51b98e71aef9e160b4692 (patch) | |
tree | da9498b7364ab71858a83b09f076b257ac8fb7b3 | |
parent | 5f18797450549e4f67a75ee2b08cd639ae1fa54d (diff) | |
download | gcc-d8808c37d29110872fa51b98e71aef9e160b4692.zip gcc-d8808c37d29110872fa51b98e71aef9e160b4692.tar.gz gcc-d8808c37d29110872fa51b98e71aef9e160b4692.tar.bz2 |
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.
-rw-r--r-- | gcc/tree-ssanames.cc | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/gcc/tree-ssanames.cc b/gcc/tree-ssanames.cc index 1eae411..0a32444 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; |