Give this a try.. I'm testing it here, but x86 doesn't seem to show it
anyway for some reason :-P
I think i needed to handle pointers special since SSA_NAMES handle
pointer ranges different.
Andrew
On 10/3/23 11:47, David Edelsohn wrote:
This patch caused a bootstrap failure on AIX.
during GIMPLE pass: evrp
/nasfarm/edelsohn/src/src/libgcc/libgcc2.c: In function '__gcc_bcmp':
/nasfarm/edelsohn/src/src/libgcc/libgcc2.c:2910:1: internal compiler
error: in get_irange, at value-range-storage.cc:343
2910 | }
| ^
0x11b7f4b7 irange_storage::get_irange(irange&, tree_node*) const
/nasfarm/edelsohn/src/src/gcc/value-range-storage.cc:343
0x11b7e7af vrange_storage::get_vrange(vrange&, tree_node*) const
/nasfarm/edelsohn/src/src/gcc/value-range-storage.cc:178
0x139f3d77 range_info_get_range(tree_node const*, vrange&)
/nasfarm/edelsohn/src/src/gcc/tree-ssanames.cc:118
0x1134b463 set_range_info(tree_node*, vrange const&)
/nasfarm/edelsohn/src/src/gcc/tree-ssanames.cc:425
0x116a7333 gimple_ranger::register_inferred_ranges(gimple*)
/nasfarm/edelsohn/src/src/gcc/gimple-range.cc:487
0x125cef27 rvrp_folder::fold_stmt(gimple_stmt_iterator*)
/nasfarm/edelsohn/src/src/gcc/tree-vrp.cc:1033
0x123dd063
substitute_and_fold_dom_walker::before_dom_children(basic_block_def*)
/nasfarm/edelsohn/src/src/gcc/tree-ssa-propagate.cc:876
0x1176cc43 dom_walker::walk(basic_block_def*)
/nasfarm/edelsohn/src/src/gcc/domwalk.cc:311
0x123dd733
substitute_and_fold_engine::substitute_and_fold(basic_block_def*)
/nasfarm/edelsohn/src/src/gcc/tree-ssa-propagate.cc:999
0x123d0f5f execute_ranger_vrp(function*, bool, bool)
/nasfarm/edelsohn/src/src/gcc/tree-vrp.cc:1062
0x123d14ef execute
/nasfarm/edelsohn/src/src/gcc/tree-vrp.cc:1142
diff --git a/gcc/tree-ssanames.cc b/gcc/tree-ssanames.cc
index 1eae411ac1c..1401f67c781 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;