diff options
author | Aldy Hernandez <aldyh@redhat.com> | 2020-10-05 17:36:13 +0200 |
---|---|---|
committer | Aldy Hernandez <aldyh@redhat.com> | 2020-10-05 19:51:36 +0200 |
commit | ea6da7f50fe2adc3a09fc10a3f437902c40ebff9 (patch) | |
tree | 9cdf2c422cb3bf145fd43b138b734bcd4b2a2dd9 /gcc/range-op.cc | |
parent | bd431d26de02180d7fac1a794e2b9d3aaa4df34d (diff) | |
download | gcc-ea6da7f50fe2adc3a09fc10a3f437902c40ebff9.zip gcc-ea6da7f50fe2adc3a09fc10a3f437902c40ebff9.tar.gz gcc-ea6da7f50fe2adc3a09fc10a3f437902c40ebff9.tar.bz2 |
Cleanup legacy_union and legacy intersect in value_range.
These are cleanups so that multi-range union/intersect doesn't
have to deal with legacy code. Instead, these should be done in
legacy mode.
gcc/ChangeLog:
* value-range.cc (irange::legacy_intersect): Only handle
legacy ranges.
(irange::legacy_union): Same.
(irange::union_): When unioning legacy with non-legacy,
first convert to legacy and do everything in legacy mode.
(irange::intersect): Same, but for intersect.
* range-op.cc (range_tests): Adjust for above changes.
Diffstat (limited to 'gcc/range-op.cc')
-rw-r--r-- | gcc/range-op.cc | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/gcc/range-op.cc b/gcc/range-op.cc index 11e847f..87c6d82 100644 --- a/gcc/range-op.cc +++ b/gcc/range-op.cc @@ -3901,6 +3901,27 @@ range_tests () r0.invert (); ASSERT_TRUE (r0.nonzero_p ()); + // test legacy interaction + // r0 = ~[1,1] + r0 = int_range<1> (UINT (1), UINT (1), VR_ANTI_RANGE); + // r1 = ~[3,3] + r1 = int_range<1> (UINT (3), UINT (3), VR_ANTI_RANGE); + + // vv = [0,0][2,2][4, MAX] + int_range<3> vv = r0; + vv.intersect (r1); + + ASSERT_TRUE (vv.contains_p (UINT (2))); + ASSERT_TRUE (vv.num_pairs () == 3); + + // create r0 as legacy [1,1] + r0 = int_range<1> (UINT (1), UINT (1)); + // And union it with [0,0][2,2][4,MAX] multi range + r0.union_ (vv); + // The result should be [0,2][4,MAX], or ~[3,3] but it must contain 2 + ASSERT_TRUE (r0.contains_p (UINT (2))); + + multi_precision_range_tests (); int_range_max_tests (); operator_tests (); |