https://gcc.gnu.org/g:99c2075f76480a18e29ff5f0feb7f994087254d5

commit r16-1563-g99c2075f76480a18e29ff5f0feb7f994087254d5
Author: Andrew MacLeod <amacl...@redhat.com>
Date:   Thu Jun 12 14:48:50 2025 -0400

    intersect_bitmask - Always update bitmask.
    
    The bitmask wasn't always being updated, resulting in some less than
    perfect masks being stored.:x
    
            * value-range.cc (irange::intersect_bitmask): Always update the
            stored mask to reflect the current calculated mask.

Diff:
---
 gcc/value-range.cc | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/gcc/value-range.cc b/gcc/value-range.cc
index 348c68ec902e..0f0770ad7051 100644
--- a/gcc/value-range.cc
+++ b/gcc/value-range.cc
@@ -2548,15 +2548,14 @@ irange::intersect_bitmask (const irange &r)
   irange_bitmask bm = get_bitmask ();
   irange_bitmask save = bm;
   bm.intersect (r.get_bitmask ());
-  if (save == bm)
-    return false;
-
+  // Use ths opportunity to make sure mask reflects always reflects the
+  // best mask we have.
   m_bitmask = bm;
 
   // Updating m_bitmask may still yield a semantic bitmask (as
   // returned by get_bitmask) which is functionally equivalent to what
   // we originally had.  In which case, there's still no change.
-  if (save == get_bitmask ())
+  if (save == bm || save == get_bitmask ())
     return false;
 
   if (!set_range_from_bitmask ())

Reply via email to