summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis
diff options
context:
space:
mode:
authorRachel Craik <rcraik@ca.ibm.com>2019-11-15 14:56:26 -0500
committerRachel Craik <rcraik@ca.ibm.com>2019-11-15 14:56:26 -0500
commitf897d087d09dbbccec3417f812109ed534b94248 (patch)
treedf810b768d3346322a1fb21798eb2cf3007b2b14 /llvm/lib/Analysis
parent1cbe0038944a39ba79078997f9c65ba8abf6fbdd (diff)
downloadbcm5719-llvm-f897d087d09dbbccec3417f812109ed534b94248.tar.gz
bcm5719-llvm-f897d087d09dbbccec3417f812109ed534b94248.zip
[LoopCacheAnalysis]: Fix assertion failure during cost computation
Ensure the stride and trip count have the same type before multiplying them during reference cost calculation Reviewed By: jdoefert Differential Revision: https://reviews.llvm.org/D70192
Diffstat (limited to 'llvm/lib/Analysis')
-rw-r--r--llvm/lib/Analysis/LoopCacheAnalysis.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/LoopCacheAnalysis.cpp b/llvm/lib/Analysis/LoopCacheAnalysis.cpp
index 098bc6f6818..25325ec1be0 100644
--- a/llvm/lib/Analysis/LoopCacheAnalysis.cpp
+++ b/llvm/lib/Analysis/LoopCacheAnalysis.cpp
@@ -284,6 +284,9 @@ CacheCostTy IndexedReference::computeRefCost(const Loop &L,
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());
+ Stride = SE.getNoopOrSignExtend(Stride, WiderType);
+ TripCount = SE.getNoopOrAnyExtend(TripCount, WiderType);
const SCEV *Numerator = SE.getMulExpr(Stride, TripCount);
RefCost = SE.getUDivExpr(Numerator, CacheLineSize);
LLVM_DEBUG(dbgs().indent(4)
OpenPOWER on IntegriCloud