mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-03-17 21:32:04 +00:00
'i8 full-range' sign extended to i16 should equal [-128, 128) not [-128, 127).
Found by Daniel Dunbar and KLEE. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75448 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
0a5372ed3e
commit
ff84de767a
@ -505,7 +505,7 @@ ConstantRange ConstantRange::signExtend(uint32_t DstTySize) const {
|
||||
assert(SrcTySize < DstTySize && "Not a value extension");
|
||||
if (isFullSet()) {
|
||||
return ConstantRange(APInt::getHighBitsSet(DstTySize,DstTySize-SrcTySize+1),
|
||||
APInt::getLowBitsSet(DstTySize, SrcTySize-1));
|
||||
APInt::getLowBitsSet(DstTySize, SrcTySize-1) + 1);
|
||||
}
|
||||
|
||||
APInt L = Lower; L.sext(DstTySize);
|
||||
|
@ -175,7 +175,7 @@ TEST_F(ConstantRangeTest, SExt) {
|
||||
ConstantRange SSome = Some.signExtend(20);
|
||||
ConstantRange SWrap = Wrap.signExtend(20);
|
||||
EXPECT_EQ(SFull, ConstantRange(APInt(20, INT16_MIN, true),
|
||||
APInt(20, INT16_MAX, true)));
|
||||
APInt(20, INT16_MAX + 1, true)));
|
||||
EXPECT_TRUE(SEmpty.isEmptySet());
|
||||
EXPECT_EQ(SOne, ConstantRange(APInt(One.getLower()).sext(20),
|
||||
APInt(One.getUpper()).sext(20)));
|
||||
|
Loading…
x
Reference in New Issue
Block a user