[ConstantRange] Fix nsw nowrap region for 1 bit integers (PR59301)
authorNikita Popov <npopov@redhat.com>
Tue, 6 Dec 2022 15:35:24 +0000 (16:35 +0100)
committerNikita Popov <npopov@redhat.com>
Tue, 6 Dec 2022 15:37:43 +0000 (16:37 +0100)
commitb04fc99c347058111cfb9313546df95e10c26132
tree77fa8d66d7ac9b1d957c04ba430d84d347b6a4ef
parent5cd900ce3c6edd9e0d9b163c9d6cf7f38688d2ee
[ConstantRange] Fix nsw nowrap region for 1 bit integers (PR59301)

The special case for V=1 was incorrect for one bit types, where
1 is also -1. Remove it, and use getNonEmpty() to handle the full
range case instead.

Adjust the exhaustive nowrap tests to test both 5 bit and 1 bit
types.

Fixes https://github.com/llvm/llvm-project/issues/59301.
llvm/lib/IR/ConstantRange.cpp
llvm/test/Transforms/CorrelatedValuePropagation/mul.ll
llvm/unittests/IR/ConstantRangeTest.cpp