diff options
author | Roman Lebedev <lebedev.ri@gmail.com> | 2020-02-25 21:51:12 +0300 |
---|---|---|
committer | Roman Lebedev <lebedev.ri@gmail.com> | 2020-02-25 23:05:57 +0300 |
commit | 2d8275d72e1602a1869e6286b0ffbf9034ab102b (patch) | |
tree | 4590e0b61eccc1d34141618cd521abfe2eb3d38a /llvm/lib/Analysis/ScalarEvolutionExpander.cpp | |
parent | 1622f3e074cb72feadd6f9d32f21d2030d3bdc47 (diff) | |
download | llvm-2d8275d72e1602a1869e6286b0ffbf9034ab102b.zip llvm-2d8275d72e1602a1869e6286b0ffbf9034ab102b.tar.gz llvm-2d8275d72e1602a1869e6286b0ffbf9034ab102b.tar.bz2 |
[SCEV] SCEVExpander::isHighCostExpansion(): assert if TTI is not provided
Summary:
Currently, as per `check-llvm`, we never call `SCEVExpander::isHighCostExpansion()` with null TTI,
so this appears to be a safe restriction.
Reviewers: reames, mkazantsev, wmi, sanjoy
Reviewed By: mkazantsev
Subscribers: javed.absar, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D73712
Diffstat (limited to 'llvm/lib/Analysis/ScalarEvolutionExpander.cpp')
-rw-r--r-- | llvm/lib/Analysis/ScalarEvolutionExpander.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/llvm/lib/Analysis/ScalarEvolutionExpander.cpp b/llvm/lib/Analysis/ScalarEvolutionExpander.cpp index e8f267a..989e864 100644 --- a/llvm/lib/Analysis/ScalarEvolutionExpander.cpp +++ b/llvm/lib/Analysis/ScalarEvolutionExpander.cpp @@ -2137,7 +2137,7 @@ SCEVExpander::getRelatedExistingExpansion(const SCEV *S, const Instruction *At, bool SCEVExpander::isHighCostExpansionHelper( const SCEV *S, Loop *L, const Instruction *At, int &BudgetRemaining, - const TargetTransformInfo *TTI, SmallPtrSetImpl<const SCEV *> &Processed) { + const TargetTransformInfo &TTI, SmallPtrSetImpl<const SCEV *> &Processed) { // Was the cost of expansion of this expression already accounted for? if (!Processed.insert(S).second) return false; // We have already accounted for this expression. @@ -2145,13 +2145,16 @@ bool SCEVExpander::isHighCostExpansionHelper( // If we can find an existing value for this scev available at the point "At" // then consider the expression cheap. if (At && getRelatedExistingExpansion(S, At, L)) - return false; + return false; // Consider the expression to be free. - // Zero/One operand expressions switch (S->getSCEVType()) { case scUnknown: case scConstant: - return false; + return false; // Assume to be zero-cost. + } + + // Zero/One operand expressions + switch (S->getSCEVType()) { case scTruncate: return isHighCostExpansionHelper(cast<SCEVTruncateExpr>(S)->getOperand(), L, At, BudgetRemaining, TTI, Processed); |