Skip to content

Commit feb9b37

Browse files
committed
[SCEV] Address post-commit comments for llvm#113915.
Address post-commit comments for llvm#113915.
1 parent ec950b2 commit feb9b37

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

llvm/include/llvm/Analysis/ScalarEvolution.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1328,7 +1328,7 @@ class ScalarEvolution {
13281328
/// Collect loop guards in \p Guards, starting from PHINode \p
13291329
/// Phi, by calling \p collectFromBlock on the incoming blocks of
13301330
/// \Phi and trying to merge the found constraints into a single
1331-
/// combined on for \p Phi.
1331+
/// combined one for \p Phi.
13321332
static void collectFromPHI(
13331333
ScalarEvolution &SE, ScalarEvolution::LoopGuards &Guards,
13341334
const PHINode &Phi, SmallPtrSetImpl<const BasicBlock *> &VisitedBlocks,

llvm/lib/Analysis/ScalarEvolution.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15274,17 +15274,17 @@ void ScalarEvolution::LoopGuards::collectFromPHI(
1527415274
if (Inserted)
1527515275
collectFromBlock(SE, G->second, Phi.getParent(), InBlock, VisitedBlocks,
1527615276
Depth + 1);
15277-
auto S = G->second.RewriteMap.find(
15278-
SE.getSCEV(Phi.getIncomingValue(IncomingIdx)));
15279-
if (S == G->second.RewriteMap.end())
15277+
auto &RewriteMap = G->second.RewriteMap;
15278+
if (RewriteMap.empty())
15279+
return {nullptr, scCouldNotCompute};
15280+
auto S = RewriteMap.find(SE.getSCEV(Phi.getIncomingValue(IncomingIdx)));
15281+
if (S == RewriteMap.end())
1528015282
return {nullptr, scCouldNotCompute};
1528115283
auto *SM = dyn_cast_if_present<SCEVMinMaxExpr>(S->second);
1528215284
if (!SM)
1528315285
return {nullptr, scCouldNotCompute};
1528415286
if (const SCEVConstant *C0 = dyn_cast<SCEVConstant>(SM->getOperand(0)))
1528515287
return {C0, SM->getSCEVType()};
15286-
if (const SCEVConstant *C1 = dyn_cast<SCEVConstant>(SM->getOperand(1)))
15287-
return {C1, SM->getSCEVType()};
1528815288
return {nullptr, scCouldNotCompute};
1528915289
};
1529015290
auto MergeMinMaxConst = [](MinMaxPattern P1,

0 commit comments

Comments
 (0)