mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
Fix a bug summing two full sets. The overflow checking doesn't handle sets as
large as the full set, only those one size smaller. Thanks to Daniel Dunbar who found this bug using Klee! llvm-svn: 75443
This commit is contained in:
parent
c6592df02d
commit
7280c39dc7
@ -533,6 +533,8 @@ ConstantRange
|
||||
ConstantRange::add(const ConstantRange &Other) const {
|
||||
if (isEmptySet() || Other.isEmptySet())
|
||||
return ConstantRange(getBitWidth(), /*isFullSet=*/false);
|
||||
if (isFullSet() || Other.isFullSet())
|
||||
return ConstantRange(getBitWidth(), /*isFullSet=*/true);
|
||||
|
||||
APInt Spread_X = getSetSize(), Spread_Y = Other.getSetSize();
|
||||
APInt NewLower = getLower() + Other.getLower();
|
||||
|
@ -239,6 +239,7 @@ TEST_F(ConstantRangeTest, SubtractAPInt) {
|
||||
|
||||
TEST_F(ConstantRangeTest, Add) {
|
||||
EXPECT_TRUE(Full.add(APInt(16, 4)).isFullSet());
|
||||
EXPECT_EQ(Full.add(Full), Full);
|
||||
EXPECT_EQ(Full.add(Empty), Empty);
|
||||
EXPECT_EQ(Full.add(One), Full);
|
||||
EXPECT_EQ(Full.add(Some), Full);
|
||||
|
Loading…
x
Reference in New Issue
Block a user