[ConstantRange] Fix sdiv() with one bit values (PR56333)
authorNikita Popov <npopov@redhat.com>
Fri, 1 Jul 2022 13:43:27 +0000 (15:43 +0200)
committerNikita Popov <npopov@redhat.com>
Fri, 1 Jul 2022 13:44:59 +0000 (15:44 +0200)
commitba1e04b9668b3502362f2ee36232f5f56e72b4e2
tree83e1124f5acb76b877f878b3d8222b39c1a5a2b4
parent5166345f50412f1a380948c18809545c4b7a9bd3
[ConstantRange] Fix sdiv() with one bit values (PR56333)

Signed one bit values can only be -1 or 0, not positive. The code
was interpreting the 1 as -1 and intersecting with a full range
rather than an empty one.

Fixes https://github.com/llvm/llvm-project/issues/56333.
llvm/lib/IR/ConstantRange.cpp
llvm/unittests/IR/ConstantRangeTest.cpp