[llvm] Fix loop cache cost to avoid cost of zero for refgroups. (PR #88915)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 16 19:24:55 PDT 2024
================
@@ -299,8 +299,15 @@ 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);
-
+ ConstantInt *One =
+ ConstantInt::get(TripCount->getType()->getContext(), APInt(32, 1));
+ bool IsZero =
+ SE.isKnownPredicate(ICmpInst::ICMP_ULT, Numerator, CacheLineSize);
----------------
nikic wrote:
Wouldn't it be simpler / more obvious to check whether the result is zero directly?
https://github.com/llvm/llvm-project/pull/88915
More information about the llvm-commits
mailing list