Fix the implementation of ConstantRange::sub(ConstantRange). Patch by Xi Wang!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133648 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Nick Lewycky
2011-06-22 21:13:46 +00:00
parent f78b5952c3
commit e6240e8b83
2 changed files with 4 additions and 2 deletions

View File

@@ -529,8 +529,8 @@ ConstantRange::sub(const ConstantRange &Other) const {
return ConstantRange(getBitWidth(), /*isFullSet=*/true);
APInt Spread_X = getSetSize(), Spread_Y = Other.getSetSize();
APInt NewLower = getLower() - Other.getLower();
APInt NewUpper = getUpper() - Other.getUpper() + 1;
APInt NewLower = getLower() - Other.getUpper() + 1;
APInt NewUpper = getUpper() - Other.getLower();
if (NewLower == NewUpper)
return ConstantRange(getBitWidth(), /*isFullSet=*/true);