IPA iunshares points-to info for prange storage objects. This means they
may point to the same logical object, but have different physical pointer
values.
A prange_storage object is a hunk of memory, and it will continue to use
raw pointer comparisons for equality. Otherwise things like hash table
lookups will think there are different hashs for the same item.
Prange however should use vrp_operand_equal_p for comparisons. This will
prevent two prange objects from comparing unequal due to tree unsharing.
PR tree-optimization/126222
* value-range-storage.cc (prange_storage::equal_p): Comment change.
* value-range.h (prange::pt_equal_p): Use vrp_operand_equal_p.
if (m_pt != r.m_pt)
return false;
+ // Storage objects are only equal If they point to the same memory.
if (m_points_to_p != r.m_points_to_p)
return false;
inline bool
prange::pt_equal_p (const prange &p) const
{
- return (m_points_to_p == p.m_points_to_p && m_pt == p.m_pt);
+ // A prange object invokes vrp_operand_equal_p as we want ranges to compare
+ // equal to each other if they refer to the same object, even if the
+ // tree has become unshared.
+ return (m_points_to_p == p.m_points_to_p
+ && vrp_operand_equal_p (m_pt, p.m_pt));
}
inline bool