From 0b7087651751039567c781f0697ed7717d763af8 Mon Sep 17 00:00:00 2001 From: Max Kazantsev Date: Mon, 12 Feb 2018 05:16:28 +0000 Subject: [PATCH] [NFC] Fix typos git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@324867 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../Scalar/InductiveRangeCheckElimination.cpp | 28 +++++++++++----------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp b/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp index 11ad4275f78..8653bede620 100644 --- a/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp +++ b/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp @@ -1633,30 +1633,30 @@ InductiveRangeCheck::computeSafeIterationSpace( unsigned BitWidth = cast(IndVar->getType())->getBitWidth(); const SCEV *SIntMax = SE.getConstant(APInt::getSignedMaxValue(BitWidth)); - // Substract Y from X so that it does not go through border of the IV + // Subtract Y from X so that it does not go through border of the IV // iteration space. Mathematically, it is equivalent to: // - // ClampedSubstract(X, Y) = min(max(X - Y, INT_MIN), INT_MAX). [1] + // ClampedSubtract(X, Y) = min(max(X - Y, INT_MIN), INT_MAX). [1] // - // In [1], 'X - Y' is a mathematical substraction (result is not bounded to + // In [1], 'X - Y' is a mathematical subtraction (result is not bounded to // any width of bit grid). But after we take min/max, the result is // guaranteed to be within [INT_MIN, INT_MAX]. // // In [1], INT_MAX and INT_MIN are respectively signed and unsigned max/min // values, depending on type of latch condition that defines IV iteration // space. - auto ClampedSubstract = [&](const SCEV *X, const SCEV *Y) { + auto ClampedSubtract = [&](const SCEV *X, const SCEV *Y) { if (IsLatchSigned) { // X is a number from signed range, Y is interpreted as signed. // Even if Y is SINT_MAX, (X - Y) does not reach SINT_MIN. So the only // thing we should care about is that we didn't cross SINT_MAX. - // So, if Y is positive, we substract Y safely. + // So, if Y is positive, we subtract Y safely. // Rule 1: Y > 0 ---> Y. - // If 0 <= -Y <= (SINT_MAX - X), we substract Y safely. + // If 0 <= -Y <= (SINT_MAX - X), we subtract Y safely. // Rule 2: Y >=s (X - SINT_MAX) ---> Y. - // If 0 <= (SINT_MAX - X) < -Y, we can only substract (X - SINT_MAX). + // If 0 <= (SINT_MAX - X) < -Y, we can only subtract (X - SINT_MAX). // Rule 3: Y (X - SINT_MAX). - // It gives us smax(Y, X - SINT_MAX) to substract in all cases. + // It gives us smax(Y, X - SINT_MAX) to subtract in all cases. const SCEV *XMinusSIntMax = SE.getMinusSCEV(X, SIntMax); return SE.getMinusSCEV(X, SE.getSMaxExpr(Y, XMinusSIntMax), SCEV::FlagNSW); @@ -1664,19 +1664,19 @@ InductiveRangeCheck::computeSafeIterationSpace( // X is a number from unsigned range, Y is interpreted as signed. // Even if Y is SINT_MIN, (X - Y) does not reach UINT_MAX. So the only // thing we should care about is that we didn't cross zero. - // So, if Y is negative, we substract Y safely. + // So, if Y is negative, we subtract Y safely. // Rule 1: Y Y. - // If 0 <= Y <= X, we substract Y safely. + // If 0 <= Y <= X, we subtract Y safely. // Rule 2: Y <=s X ---> Y. - // If 0 <= X < Y, we should stop at 0 and can only substract X. + // If 0 <= X < Y, we should stop at 0 and can only subtract X. // Rule 3: Y >s X ---> X. - // It gives us smin(X, Y) to substract in all cases. + // It gives us smin(X, Y) to subtract in all cases. return SE.getMinusSCEV(X, SE.getSMinExpr(X, Y), SCEV::FlagNUW); }; const SCEV *M = SE.getMinusSCEV(C, A); const SCEV *Zero = SE.getZero(M->getType()); - const SCEV *Begin = ClampedSubstract(Zero, M); - const SCEV *End = ClampedSubstract(getEnd(), M); + const SCEV *Begin = ClampedSubtract(Zero, M); + const SCEV *End = ClampedSubtract(getEnd(), M); return InductiveRangeCheck::Range(Begin, End); } -- 2.11.0