diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2024-07-27 23:34:35 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2024-10-23 18:26:01 +0000 |
commit | 0fca6ea1d4eea4c934cfff25ac9ee8ad6fe95583 (patch) | |
tree | 6cf5ab1f05330c6773b1f3f64799d56a9c7a1faa /contrib/llvm-project/llvm/lib/Analysis/LoopCacheAnalysis.cpp | |
parent | 6b9f7133aba44189d9625c352bc2c2a59baf18ef (diff) | |
parent | ac9a064cb179f3425b310fa2847f8764ac970a4d (diff) |
Diffstat (limited to 'contrib/llvm-project/llvm/lib/Analysis/LoopCacheAnalysis.cpp')
-rw-r--r-- | contrib/llvm-project/llvm/lib/Analysis/LoopCacheAnalysis.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/contrib/llvm-project/llvm/lib/Analysis/LoopCacheAnalysis.cpp b/contrib/llvm-project/llvm/lib/Analysis/LoopCacheAnalysis.cpp index c3a56639b5c8..7ca9f15ad5fc 100644 --- a/contrib/llvm-project/llvm/lib/Analysis/LoopCacheAnalysis.cpp +++ b/contrib/llvm-project/llvm/lib/Analysis/LoopCacheAnalysis.cpp @@ -299,7 +299,12 @@ CacheCostTy IndexedReference::computeRefCost(const Loop &L, Stride = SE.getNoopOrAnyExtend(Stride, WiderType); TripCount = SE.getNoopOrZeroExtend(TripCount, WiderType); const SCEV *Numerator = SE.getMulExpr(Stride, TripCount); - RefCost = SE.getUDivExpr(Numerator, CacheLineSize); + // Round the fractional cost up to the nearest integer number. + // The impact is the most significant when cost is calculated + // to be a number less than one, because it makes more sense + // to say one cache line is used rather than zero cache line + // is used. + RefCost = SE.getUDivCeilSCEV(Numerator, CacheLineSize); LLVM_DEBUG(dbgs().indent(4) << "Access is consecutive: RefCost=(TripCount*Stride)/CLS=" @@ -315,7 +320,7 @@ CacheCostTy IndexedReference::computeRefCost(const Loop &L, RefCost = TripCount; int Index = getSubscriptIndex(L); - assert(Index >= 0 && "Cound not locate a valid Index"); + assert(Index >= 0 && "Could not locate a valid Index"); for (unsigned I = Index + 1; I < getNumSubscripts() - 1; ++I) { const SCEVAddRecExpr *AR = dyn_cast<SCEVAddRecExpr>(getSubscript(I)); |