1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 11:42:57 +01:00

[ConstantRange] [a, b) udiv a full range is [0, umax(b)).

Reviewers: nikic, spatel, efriedma

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D60536

llvm-svn: 359180
This commit is contained in:
Florian Hahn 2019-04-25 10:12:43 +00:00
parent 8c502c592b
commit 05a8a51e88
2 changed files with 10 additions and 2 deletions

View File

@ -974,8 +974,6 @@ ConstantRange
ConstantRange::udiv(const ConstantRange &RHS) const {
if (isEmptySet() || RHS.isEmptySet() || RHS.getUnsignedMax().isNullValue())
return getEmpty();
if (RHS.isFullSet())
return getFull();
APInt Lower = getUnsignedMin().udiv(RHS.getUnsignedMax());

View File

@ -821,6 +821,16 @@ TEST_F(ConstantRangeTest, UDiv) {
EXPECT_EQ(Some.udiv(Some), ConstantRange(APInt(16, 0), APInt(16, 0x111)));
EXPECT_EQ(Some.udiv(Wrap), ConstantRange(APInt(16, 0), APInt(16, 0xaaa)));
EXPECT_EQ(Wrap.udiv(Wrap), Full);
ConstantRange Zero(APInt(16, 0));
EXPECT_EQ(Zero.udiv(One), Zero);
EXPECT_EQ(Zero.udiv(Full), Zero);
EXPECT_EQ(ConstantRange(APInt(16, 0), APInt(16, 99)).udiv(Full),
ConstantRange(APInt(16, 0), APInt(16, 99)));
EXPECT_EQ(ConstantRange(APInt(16, 10), APInt(16, 99)).udiv(Full),
ConstantRange(APInt(16, 0), APInt(16, 99)));
}
TEST_F(ConstantRangeTest, URem) {