in a previous API version, the result of invariant_p and
invariant_away_p returned the object or NULL. When I converted to this
API, i missed hangeing the results to either true or false. Fixed thusly.
Bootstrapped on x86_64-pc-linux-gnu with no regressions. Pushed.
Andrew
From 8434c6c12342ec407b9184c92582cb4b691fdc9c Mon Sep 17 00:00:00 2001
From: Andrew MacLeod <[email protected]>
Date: Thu, 18 Jun 2026 10:58:57 -0400
Subject: [PATCH 2/3] invariant_p should return true or false instead of a tree
left from a previous API version, the boolean result should be true
or false, not a TREE which is then converted to a boolean.
* value-range.h (prange::pt_invariant_p): Return true or false.
(prange::pt_invariant_away_p): Likewise.
---
gcc/value-range.h | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/gcc/value-range.h b/gcc/value-range.h
index abed19d9209..d5588faefb4 100644
--- a/gcc/value-range.h
+++ b/gcc/value-range.h
@@ -461,12 +461,16 @@ public:
tree pt_invariant () const;
tree pt_invariant_away () const;
- // Return true if present and identical for THIS and R.
+ // Return true if THIS and R both point to the same object.
bool pt_invariant_p (const prange &r) const;
+ // Return true if THIS and R both point away from the same object.
bool pt_invariant_away_p (const prange &r) const;
+ // Return true if THIS and R refer to the same object, and one is inverted
+ // from the other, Ie, both to and away.
+ bool pt_inverted_p (const prange &r) const;
+ // Invert THIS if it points either to or away from an object.
bool pt_invert ();
- bool pt_inverted_p (const prange &r) const;
// pt_base () - object/allocation the pointer refers into.
tree pt_base () const;
@@ -1555,8 +1559,8 @@ prange::pt_invariant_p (const prange &r) const
{
if (m_pt && m_points_to_p && vrp_operand_equal_p (r.m_pt, m_pt)
&& m_points_to_p == r.m_points_to_p)
- return m_pt;
- return NULL_TREE;
+ return true;
+ return false;
}
inline bool
@@ -1564,8 +1568,8 @@ prange::pt_invariant_away_p (const prange &r) const
{
if (m_pt && !m_points_to_p && vrp_operand_equal_p (r.m_pt, m_pt)
&& m_points_to_p == r.m_points_to_p)
- return m_pt;
- return NULL_TREE;
+ return true;
+ return false;
}
--
2.45.0