From 99c2075f76480a18e29ff5f0feb7f994087254d5 Mon Sep 17 00:00:00 2001 From: Andrew MacLeod Date: Thu, 12 Jun 2025 14:48:50 -0400 Subject: [PATCH] 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. --- 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 348c68ec902..0f0770ad705 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 ()) -- 2.47.2