[llvm] a47b2d4 - [SCEV] Remove unused parameter from computeBECount [NFC]
Philip Reames via llvm-commits
llvm-commits at lists.llvm.org
Tue May 25 09:59:27 PDT 2021
Author: Philip Reames
Date: 2021-05-25T09:58:56-07:00
New Revision: a47b2d4567ac27eee8d355c079535a796639a041
URL: https://github.com/llvm/llvm-project/commit/a47b2d4567ac27eee8d355c079535a796639a041
DIFF: https://github.com/llvm/llvm-project/commit/a47b2d4567ac27eee8d355c079535a796639a041.diff
LOG: [SCEV] Remove unused parameter from computeBECount [NFC]
All callers pass "false" for the Equality parameter. Kill the dead code, and update the function block comment.
Added:
Modified:
llvm/include/llvm/Analysis/ScalarEvolution.h
llvm/lib/Analysis/ScalarEvolution.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/Analysis/ScalarEvolution.h b/llvm/include/llvm/Analysis/ScalarEvolution.h
index b80b929e26f63..2afa2d1b25b8c 100644
--- a/llvm/include/llvm/Analysis/ScalarEvolution.h
+++ b/llvm/include/llvm/Analysis/ScalarEvolution.h
@@ -1983,10 +1983,12 @@ class ScalarEvolution {
Optional<std::pair<const SCEV *, SmallVector<const SCEVPredicate *, 3>>>
createAddRecFromPHIWithCastsImpl(const SCEVUnknown *SymbolicPHI);
- /// Compute the backedge taken count knowing the interval
diff erence, the
- /// stride and presence of the equality in the comparison.
- const SCEV *computeBECount(const SCEV *Delta, const SCEV *Stride,
- bool Equality);
+ /// Compute the backedge taken count knowing the interval
diff erence, and
+ /// the stride for an inequality. Result takes the form:
+ /// (Delta + (Stride - 1)) udiv Stride.
+ /// Caller must ensure that this expression either does not overflow or
+ /// that the result is undefined if it does.
+ const SCEV *computeBECount(const SCEV *Delta, const SCEV *Stride);
/// Compute the maximum backedge count based on the range of values
/// permitted by Start, End, and Stride. This is for loops of the form
diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp
index 126e0c310ce26..af5e8bd66bfa9 100644
--- a/llvm/lib/Analysis/ScalarEvolution.cpp
+++ b/llvm/lib/Analysis/ScalarEvolution.cpp
@@ -11233,11 +11233,10 @@ bool ScalarEvolution::doesIVOverflowOnGT(const SCEV *RHS, const SCEV *Stride,
return (std::move(MinValue) + MaxStrideMinusOne).ugt(MinRHS);
}
-const SCEV *ScalarEvolution::computeBECount(const SCEV *Delta, const SCEV *Step,
- bool Equality) {
+const SCEV *ScalarEvolution::computeBECount(const SCEV *Delta,
+ const SCEV *Step) {
const SCEV *One = getOne(Step->getType());
- Delta = Equality ? getAddExpr(Delta, Step)
- : getAddExpr(Delta, getMinusSCEV(Step, One));
+ Delta = getAddExpr(Delta, getMinusSCEV(Step, One));
return getUDivExpr(Delta, Step);
}
@@ -11278,8 +11277,7 @@ const SCEV *ScalarEvolution::computeMaxBECountForLT(const SCEV *Start,
: APIntOps::umin(getUnsignedRangeMax(End), Limit);
MaxBECount = computeBECount(getConstant(MaxEnd - MinStart) /* Delta */,
- getConstant(StrideForMaxBECount) /* Step */,
- false /* Equality */);
+ getConstant(StrideForMaxBECount) /* Step */);
return MaxBECount;
}
@@ -11387,7 +11385,7 @@ ScalarEvolution::howManyLessThans(const SCEV *LHS, const SCEV *RHS,
// is the LHS value of the less-than comparison the first time it is evaluated
// and End is the RHS.
const SCEV *BECountIfBackedgeTaken =
- computeBECount(getMinusSCEV(End, Start), Stride, false);
+ computeBECount(getMinusSCEV(End, Start), Stride);
// If the loop entry is guarded by the result of the backedge test of the
// first loop iteration, then we know the backedge will be taken at least
// once and so the backedge taken count is as above. If not then we use the
@@ -11406,7 +11404,7 @@ ScalarEvolution::howManyLessThans(const SCEV *LHS, const SCEV *RHS,
End = RHS;
else
End = IsSigned ? getSMaxExpr(RHS, Start) : getUMaxExpr(RHS, Start);
- BECount = computeBECount(getMinusSCEV(End, Start), Stride, false);
+ BECount = computeBECount(getMinusSCEV(End, Start), Stride);
}
const SCEV *MaxBECount;
@@ -11482,7 +11480,7 @@ ScalarEvolution::howManyGreaterThans(const SCEV *LHS, const SCEV *RHS,
End = IsSigned ? getSMinExpr(RHS, Start) : getUMinExpr(RHS, Start);
}
- const SCEV *BECount = computeBECount(getMinusSCEV(Start, End), Stride, false);
+ const SCEV *BECount = computeBECount(getMinusSCEV(Start, End), Stride);
APInt MaxStart = IsSigned ? getSignedRangeMax(Start)
: getUnsignedRangeMax(Start);
@@ -11504,7 +11502,7 @@ ScalarEvolution::howManyGreaterThans(const SCEV *LHS, const SCEV *RHS,
const SCEV *MaxBECount = isa<SCEVConstant>(BECount)
? BECount
: computeBECount(getConstant(MaxStart - MinEnd),
- getConstant(MinStride), false);
+ getConstant(MinStride));
if (isa<SCEVCouldNotCompute>(MaxBECount))
MaxBECount = BECount;
More information about the llvm-commits
mailing list