]> git.ipfire.org Git - thirdparty/gcc.git/commit
irange: keep better track of powers of 2.
authorAldy Hernandez <aldyh@redhat.com>
Tue, 27 Sep 2022 06:05:30 +0000 (08:05 +0200)
committerAldy Hernandez <aldyh@redhat.com>
Tue, 27 Sep 2022 08:43:11 +0000 (10:43 +0200)
commitbe4a6551ed37c1e7dbdfb9400fc2e2b5d40c5be2
treea6917d20d2b4d0c3b4a6abbc47c58b7495d48bf0
parent1db05e1a1c1ee3d8a95826d477173fb7c557c002
irange: keep better track of powers of 2.

When setting the nonzero bits to a mask containing only one bit, set
the range immediately, as it can be devined from the mask.  This helps
us keep better track of powers of two.

For example, with this patch a nonzero mask of 0x8000 is set to a
range of [0,0][0x8000,0x8000] with a nonzero mask of 0x8000.

gcc/ChangeLog:

* value-range.cc (irange::set_nonzero_bits): Set range when known.

gcc/testsuite/ChangeLog:

* gcc.dg/tree-ssa/popcount6.c: New test.
gcc/testsuite/gcc.dg/tree-ssa/popcount6.c [new file with mode: 0644]
gcc/value-range.cc