aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib
diff options
context:
space:
mode:
authorFlorian Hahn <flo@fhahn.com>2024-11-17 19:31:53 +0000
committerFlorian Hahn <flo@fhahn.com>2024-11-17 19:31:56 +0000
commitfeb9b3701bf6650f91e12e7f4efbe72383f3f60b (patch)
tree97c93b1bdca90a92b62e03882684ce9ff8fa73a3 /llvm/lib
parentec950b206353cfc36fb0701f1a77cc18aa2d18aa (diff)
downloadllvm-feb9b3701bf6650f91e12e7f4efbe72383f3f60b.zip
llvm-feb9b3701bf6650f91e12e7f4efbe72383f3f60b.tar.gz
llvm-feb9b3701bf6650f91e12e7f4efbe72383f3f60b.tar.bz2
[SCEV] Address post-commit comments for #113915.
Address post-commit comments for https://github.com/llvm/llvm-project/pull/113915.
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Analysis/ScalarEvolution.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp
index 5182285..46b1086 100644
--- a/llvm/lib/Analysis/ScalarEvolution.cpp
+++ b/llvm/lib/Analysis/ScalarEvolution.cpp
@@ -15274,17 +15274,17 @@ void ScalarEvolution::LoopGuards::collectFromPHI(
if (Inserted)
collectFromBlock(SE, G->second, Phi.getParent(), InBlock, VisitedBlocks,
Depth + 1);
- auto S = G->second.RewriteMap.find(
- SE.getSCEV(Phi.getIncomingValue(IncomingIdx)));
- if (S == G->second.RewriteMap.end())
+ auto &RewriteMap = G->second.RewriteMap;
+ if (RewriteMap.empty())
+ return {nullptr, scCouldNotCompute};
+ auto S = RewriteMap.find(SE.getSCEV(Phi.getIncomingValue(IncomingIdx)));
+ if (S == RewriteMap.end())
return {nullptr, scCouldNotCompute};
auto *SM = dyn_cast_if_present<SCEVMinMaxExpr>(S->second);
if (!SM)
return {nullptr, scCouldNotCompute};
if (const SCEVConstant *C0 = dyn_cast<SCEVConstant>(SM->getOperand(0)))
return {C0, SM->getSCEVType()};
- if (const SCEVConstant *C1 = dyn_cast<SCEVConstant>(SM->getOperand(1)))
- return {C1, SM->getSCEVType()};
return {nullptr, scCouldNotCompute};
};
auto MergeMinMaxConst = [](MinMaxPattern P1,