diff options
Diffstat (limited to 'contrib/llvm-project/llvm/lib/Analysis/LoopCacheAnalysis.cpp')
-rw-r--r-- | contrib/llvm-project/llvm/lib/Analysis/LoopCacheAnalysis.cpp | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/contrib/llvm-project/llvm/lib/Analysis/LoopCacheAnalysis.cpp b/contrib/llvm-project/llvm/lib/Analysis/LoopCacheAnalysis.cpp index 8a613647bbea..7b895d8a5dc2 100644 --- a/contrib/llvm-project/llvm/lib/Analysis/LoopCacheAnalysis.cpp +++ b/contrib/llvm-project/llvm/lib/Analysis/LoopCacheAnalysis.cpp @@ -30,6 +30,7 @@ #include "llvm/ADT/Sequence.h" #include "llvm/ADT/SmallVector.h" #include "llvm/Analysis/AliasAnalysis.h" +#include "llvm/Analysis/Delinearization.h" #include "llvm/Analysis/DependenceAnalysis.h" #include "llvm/Analysis/LoopInfo.h" #include "llvm/Analysis/ScalarEvolutionExpressions.h" @@ -290,8 +291,8 @@ CacheCostTy IndexedReference::computeRefCost(const Loop &L, const SCEV *Coeff = getLastCoefficient(); const SCEV *ElemSize = Sizes.back(); const SCEV *Stride = SE.getMulExpr(Coeff, ElemSize); - const SCEV *CacheLineSize = SE.getConstant(Stride->getType(), CLS); Type *WiderType = SE.getWiderType(Stride->getType(), TripCount->getType()); + const SCEV *CacheLineSize = SE.getConstant(WiderType, CLS); if (SE.isKnownNegative(Stride)) Stride = SE.getNegativeSCEV(Stride); Stride = SE.getNoopOrAnyExtend(Stride, WiderType); @@ -344,8 +345,8 @@ bool IndexedReference::delinearize(const LoopInfo &LI) { LLVM_DEBUG(dbgs().indent(2) << "In Loop '" << L->getName() << "', AccessFn: " << *AccessFn << "\n"); - SE.delinearize(AccessFn, Subscripts, Sizes, - SE.getElementSize(&StoreOrLoadInst)); + llvm::delinearize(SE, AccessFn, Subscripts, Sizes, + SE.getElementSize(&StoreOrLoadInst)); if (Subscripts.empty() || Sizes.empty() || Subscripts.size() != Sizes.size()) { @@ -425,9 +426,7 @@ bool IndexedReference::isConsecutive(const Loop &L, unsigned CLS) const { const SCEV *IndexedReference::getLastCoefficient() const { const SCEV *LastSubscript = getLastSubscript(); - assert(isa<SCEVAddRecExpr>(LastSubscript) && - "Expecting a SCEV add recurrence expression"); - const SCEVAddRecExpr *AR = dyn_cast<SCEVAddRecExpr>(LastSubscript); + auto *AR = cast<SCEVAddRecExpr>(LastSubscript); return AR->getStepRecurrence(SE); } @@ -522,10 +521,9 @@ void CacheCost::calculateCacheFootprint() { LLVM_DEBUG(dbgs() << "COMPUTING LOOP CACHE COSTS\n"); for (const Loop *L : Loops) { - assert((std::find_if(LoopCosts.begin(), LoopCosts.end(), - [L](const LoopCacheCostTy &LCC) { - return LCC.first == L; - }) == LoopCosts.end()) && + assert(llvm::none_of( + LoopCosts, + [L](const LoopCacheCostTy &LCC) { return LCC.first == L; }) && "Should not add duplicate element"); CacheCostTy LoopCost = computeLoopCacheCost(*L, RefGroups); LoopCosts.push_back(std::make_pair(L, LoopCost)); |