From 5aacc7a573111cddbb0275642c023f026af300bc Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Mon, 22 Apr 2019 09:01:38 +0000 Subject: 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 --- llvm/lib/IR/ConstantRange.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'llvm/lib/IR/ConstantRange.cpp') 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)); -- cgit v1.2.3