[llvm] Fix loop cache cost to avoid cost of zero for refgroups. (PR #88915)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 23 21:48:42 PDT 2024
================
@@ -299,7 +299,10 @@ 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 costs up to the nearest whole number i.e. when cost is
+ // calculated 12.5, it makes more sense to say 13 cache lines are used
+ // rather than 12 cache lines.
----------------
CongzheUalberta wrote:
// Round the cost up to the nearest integer number, e.g., when cost is
// calculated to be a number less than one, it makes more sense to say
// one cache line is used rather than zero cache line is used.
https://github.com/llvm/llvm-project/pull/88915
More information about the llvm-commits
mailing list