]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[range-ops] Handle bitmasks for BIT_NOT_EXPR.
authorAldy Hernandez <aldyh@redhat.com>
Tue, 25 Jul 2023 16:34:21 +0000 (12:34 -0400)
committerAldy Hernandez <aldyh@redhat.com>
Wed, 26 Jul 2023 08:41:16 +0000 (10:41 +0200)
gcc/ChangeLog:

* range-op-mixed.h (class operator_bitwise_not): Add update_bitmask.
* range-op.cc (operator_bitwise_not::update_bitmask): New.

gcc/range-op-mixed.h
gcc/range-op.cc

index 6944742ecbc1015fbdb12ffec575382fb788faae..ead41ed05158ab7f2bb92e7dedbb2aab992e2a01 100644 (file)
@@ -551,6 +551,8 @@ public:
   bool op1_range (irange &r, tree type,
                  const irange &lhs, const irange &op2,
                  relation_trio rel = TRIO_VARYING) const final override;
+  void update_bitmask (irange &r, const irange &lh,
+                      const irange &rh) const final override;
 };
 
 class operator_bitwise_xor : public range_operator
index d959a3e93dce81cd0d8832bde4f8082e64e8be1b..13ba973a08da92ebd7c39f1ae5cd12ac841dfc3d 100644 (file)
@@ -4027,6 +4027,13 @@ operator_bitwise_not::op1_range (irange &r, tree type,
   return fold_range (r, type, lhs, op2);
 }
 
+void
+operator_bitwise_not::update_bitmask (irange &r, const irange &lh,
+                                     const irange &rh) const
+{
+  update_known_bitmask (r, BIT_NOT_EXPR, lh, rh);
+}
+
 
 bool
 operator_cst::fold_range (irange &r, tree type ATTRIBUTE_UNUSED,