aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/LoopCacheAnalysis.cpp
diff options
context:
space:
mode:
authorTsang Whitney W.H <whitneyt@recycler.canlab.ibm.com>2019-11-10 05:39:40 +0000
committerTsang Whitney W.H <whitneyt@recycler.canlab.ibm.com>2019-11-10 05:39:40 +0000
commit89453d186dc6ef985965f621efaa409f0ab7ede2 (patch)
tree029647e1bfc2dc35abbc07260acfe3b3a2fea93d /llvm/lib/Analysis/LoopCacheAnalysis.cpp
parentc2751737e58c86a9c90bc8d6246893abcb06c3ca (diff)
downloadllvm-89453d186dc6ef985965f621efaa409f0ab7ede2.zip
llvm-89453d186dc6ef985965f621efaa409f0ab7ede2.tar.gz
llvm-89453d186dc6ef985965f621efaa409f0ab7ede2.tar.bz2
[NFC]: Fix PVS Studio warning in LoopNestAnalysis
Summary:This patch fixes the following warnings uncovered by PVS Studio: /home/xbolva00/LLVM/llvm-project/llvm/lib/Analysis/LoopCacheAnalysis.cpp 353 warn V612 An unconditional 'return' within a loop. /home/xbolva00/LLVM/llvm-project/llvm/lib/Analysis/LoopCacheAnalysis.cpp 456 err V502 Perhaps the '?:' operator works in a different way than it was expected. The '?:' operator has a lower priority than the '==' operator. Authored By:etiotto Reviewer:Meinersbur, kbarton, bmahjour, Whitney, xbolva00 Reviewed By:xbolva00 Subscribers:hiraditya, llvm-commits Tag:LLVM Differential Revision:https://reviews.llvm.org/D69821
Diffstat (limited to 'llvm/lib/Analysis/LoopCacheAnalysis.cpp')
-rw-r--r--llvm/lib/Analysis/LoopCacheAnalysis.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/Analysis/LoopCacheAnalysis.cpp b/llvm/lib/Analysis/LoopCacheAnalysis.cpp
index 10d2fe0..137b53c 100644
--- a/llvm/lib/Analysis/LoopCacheAnalysis.cpp
+++ b/llvm/lib/Analysis/LoopCacheAnalysis.cpp
@@ -313,7 +313,7 @@ bool IndexedReference::delinearize(const LoopInfo &LI) {
const SCEV *ElemSize = SE.getElementSize(&StoreOrLoadInst);
const BasicBlock *BB = StoreOrLoadInst.getParent();
- for (Loop *L = LI.getLoopFor(BB); L != nullptr; L = L->getParentLoop()) {
+ if (Loop *L = LI.getLoopFor(BB)) {
const SCEV *AccessFn =
SE.getSCEVAtScope(getPointerOperand(&StoreOrLoadInst), L);
@@ -342,7 +342,7 @@ bool IndexedReference::delinearize(const LoopInfo &LI) {
<< "ERROR: failed to delinearize reference\n");
Subscripts.clear();
Sizes.clear();
- break;
+ return false;
}
const SCEV *Div = SE.getUDivExactExpr(AccessFn, ElemSize);
@@ -453,7 +453,7 @@ CacheCost::CacheCost(const LoopVectorTy &Loops, const LoopInfo &LI,
AliasAnalysis &AA, DependenceInfo &DI,
Optional<unsigned> TRT)
: Loops(Loops), TripCounts(), LoopCosts(),
- TRT(TRT == None ? Optional<unsigned>(TemporalReuseThreshold) : TRT),
+ TRT((TRT == None) ? Optional<unsigned>(TemporalReuseThreshold) : TRT),
LI(LI), SE(SE), TTI(TTI), AA(AA), DI(DI) {
assert(!Loops.empty() && "Expecting a non-empty loop vector.");