]> git.ipfire.org Git - thirdparty/gcc.git/commit
Use nonzero bits in range-ops to determine if < 0 is false.
authorAldy Hernandez <aldyh@redhat.com>
Tue, 12 Jul 2022 07:37:13 +0000 (09:37 +0200)
committerAldy Hernandez <aldyh@redhat.com>
Wed, 13 Jul 2022 14:25:28 +0000 (16:25 +0200)
commit1184f677d6e17033572ecc5e97ea5ee627627908
tree2bcbdcd5264a740f41cef764d07b0d6229c17ab8
parent554b21edb9ec91a898125d4915d790c6d4b9a688
Use nonzero bits in range-ops to determine if < 0 is false.

For a signed integer, x < 0 is false if the sign bit in the nonzero
bits of X is clear.

Both CCP and ipa-cp can set the global nonzero bits in a range, which
means we can now use some of that information in evrp and subsequent
passes.  I've adjusted two tests which now fold things earlier because
of this optimization.

Tested on x86-64 Linux.

gcc/ChangeLog:

* range-op.cc (operator_lt::fold_range): Use nonzero bits.

gcc/testsuite/ChangeLog:

* g++.dg/ipa/pure-const-3.C: Adjust.
* gcc.dg/pr102983.c: Adjust.
gcc/range-op.cc
gcc/testsuite/g++.dg/ipa/pure-const-3.C
gcc/testsuite/gcc.dg/pr102983.c