summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/ValueTracking.cpp
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2019-04-21 15:22:54 +0000
committerNikita Popov <nikita.ppv@gmail.com>2019-04-21 15:22:54 +0000
commitdbc3fbafe7cbf10bac30da4d4b6eb6082fed3daa (patch)
tree5ca3301d2c529849b90e76efc5bda9f91583ab70 /llvm/lib/Analysis/ValueTracking.cpp
parent7fa3a0eec9792c5da235ade683013a742871b8c5 (diff)
downloadbcm5719-llvm-dbc3fbafe7cbf10bac30da4d4b6eb6082fed3daa.tar.gz
bcm5719-llvm-dbc3fbafe7cbf10bac30da4d4b6eb6082fed3daa.zip
[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 llvm-svn: 358854
Diffstat (limited to 'llvm/lib/Analysis/ValueTracking.cpp')
-rw-r--r--llvm/lib/Analysis/ValueTracking.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp
index 9c7b0fad5a8..3b08a2dc7a1 100644
--- a/llvm/lib/Analysis/ValueTracking.cpp
+++ b/llvm/lib/Analysis/ValueTracking.cpp
@@ -5726,8 +5726,7 @@ ConstantRange llvm::computeConstantRange(const Value *V, bool UseInstrInfo) {
else if (auto *SI = dyn_cast<SelectInst>(V))
setLimitsForSelectPattern(*SI, Lower, Upper);
- ConstantRange CR = Lower != Upper ? ConstantRange(Lower, Upper)
- : ConstantRange::getFull(BitWidth);
+ ConstantRange CR = ConstantRange::getNonEmpty(Lower, Upper);
if (auto *I = dyn_cast<Instruction>(V))
if (auto *Range = IIQ.getMetadata(I, LLVMContext::MD_range))
OpenPOWER on IntegriCloud