llvm.org GIT mirror llvm / 780905e
Fix an error in ConstantRange::getSignedMax on wrapped ranges. Thanks once again to Daniel Dunbar and KLEE! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75449 91177308-0d34-0410-b5e6-96231b3b80d8 Nick Lewycky 10 years ago
2 changed file(s) with 7 addition(s) and 7 deletion(s). Raw diff Collapse all Expand all
158158 else
159159 return SignedMax;
160160 } else {
161 if ((getUpper() - 1).slt(getLower())) {
162 if (getLower() != SignedMax)
163 return SignedMax;
164 else
165 return getUpper() - 1;
166 } else {
161 if (getLower().isNegative() == getUpper().isNegative())
162 return SignedMax;
163 else
167164 return getUpper() - 1;
168 }
169165 }
170166 }
171167
136136 EXPECT_EQ(One.getSignedMin(), APInt(16, 0xa));
137137 EXPECT_EQ(Some.getSignedMin(), APInt(16, 0xa));
138138 EXPECT_EQ(Wrap.getSignedMin(), APInt(16, INT16_MIN));
139
140 // Found by Klee
141 EXPECT_EQ(ConstantRange(APInt(4, 7), APInt(4, 0)).getSignedMax(),
142 APInt(4, 7));
139143 }
140144
141145 TEST_F(ConstantRangeTest, Trunc) {