summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/ConstantRange.cpp
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2019-04-22 09:01:38 +0000
committerNikita Popov <nikita.ppv@gmail.com>2019-04-22 09:01:38 +0000
commit5aacc7a573111cddbb0275642c023f026af300bc (patch)
treebcad06c507c490a4391064d6af2c5191a4e2adda /llvm/lib/IR/ConstantRange.cpp
parent5299e25f502131483c4555efa641b93bad81a893 (diff)
downloadbcm5719-llvm-5aacc7a573111cddbb0275642c023f026af300bc.tar.gz
bcm5719-llvm-5aacc7a573111cddbb0275642c023f026af300bc.zip
Revert "[ConstantRange] Rename make{Guaranteed -> Exact}NoWrapRegion() NFC"
This reverts commit 7bf4d7c07f2fac862ef34c82ad0fef6513452445. After thinking about this more, this isn't right, the range is not exact in the same sense as makeExactICmpRegion(). This needs a separate function. llvm-svn: 358876
Diffstat (limited to 'llvm/lib/IR/ConstantRange.cpp')
-rw-r--r--llvm/lib/IR/ConstantRange.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/llvm/lib/IR/ConstantRange.cpp b/llvm/lib/IR/ConstantRange.cpp
index 3e1d7e471f1..b2bdd0abd9c 100644
--- a/llvm/lib/IR/ConstantRange.cpp
+++ b/llvm/lib/IR/ConstantRange.cpp
@@ -181,9 +181,9 @@ bool ConstantRange::getEquivalentICmp(CmpInst::Predicate &Pred,
}
ConstantRange
-ConstantRange::makeExactNoWrapRegion(Instruction::BinaryOps BinOp,
- const ConstantRange &Other,
- unsigned NoWrapKind) {
+ConstantRange::makeGuaranteedNoWrapRegion(Instruction::BinaryOps BinOp,
+ const ConstantRange &Other,
+ unsigned NoWrapKind) {
using OBO = OverflowingBinaryOperator;
// Computes the intersection of CR0 and CR1. It is different from
@@ -262,7 +262,7 @@ ConstantRange::makeExactNoWrapRegion(Instruction::BinaryOps BinOp,
return Result;
case Instruction::Mul: {
- // Equivalent to calling makeExactNoWrapRegion() on [V, V+1).
+ // Equivalent to calling makeGuaranteedNoWrapRegion() on [V, V+1).
const bool Unsigned = NoWrapKind == OBO::NoUnsignedWrap;
const auto makeSingleValueRegion = [Unsigned,
BitWidth](APInt V) -> ConstantRange {
@@ -841,9 +841,10 @@ ConstantRange::add(const ConstantRange &Other) const {
ConstantRange ConstantRange::addWithNoSignedWrap(const APInt &Other) const {
// Calculate the subset of this range such that "X + Other" is
// guaranteed not to wrap (overflow) for all X in this subset.
- auto NSWRange = ConstantRange::makeExactNoWrapRegion(
- BinaryOperator::Add, ConstantRange(Other),
- OverflowingBinaryOperator::NoSignedWrap);
+ // makeGuaranteedNoWrapRegion will produce an exact NSW range.
+ auto NSWRange = ConstantRange::makeGuaranteedNoWrapRegion(BinaryOperator::Add,
+ ConstantRange(Other),
+ OverflowingBinaryOperator::NoSignedWrap);
auto NSWConstrainedRange = intersectWith(NSWRange);
return NSWConstrainedRange.add(ConstantRange(Other));
OpenPOWER on IntegriCloud