mirror of
https://github.com/RPCS3/llvm.git
synced 2026-07-19 23:23:38 -04:00
[ConstantRange] Add getNonEmpty() constructor
ConstantRanges have an annoying special case: If upper and lower are the same, it can be either an empty or a full set. When constructing constant ranges nearly always a full set is intended, but this still requires an explicit check in many places. This revision adds a getNonEmpty() constructor that disambiguates this case: If upper and lower are the same, a full set is created. Differential Revision: https://reviews.llvm.org/D60947 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358854 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -5808,12 +5808,8 @@ static ConstantRange getRangeForAffineARHelper(APInt Step,
|
||||
Descending ? std::move(StartUpper) : std::move(MovedBoundary);
|
||||
NewUpper += 1;
|
||||
|
||||
// If we end up with full range, return a proper full range.
|
||||
if (NewLower == NewUpper)
|
||||
return ConstantRange::getFull(BitWidth);
|
||||
|
||||
// No overflow detected, return [StartLower, StartUpper + Offset + 1) range.
|
||||
return ConstantRange(std::move(NewLower), std::move(NewUpper));
|
||||
return ConstantRange::getNonEmpty(std::move(NewLower), std::move(NewUpper));
|
||||
}
|
||||
|
||||
ConstantRange ScalarEvolution::getRangeForAffineAR(const SCEV *Start,
|
||||
|
||||
Reference in New Issue
Block a user