@@ -9571,15 +9571,14 @@ getConstantEvolvingPHIOperands(Instruction *UseInst, const Loop *L,
9571
9571
if (!OpInst || !canConstantEvolve(OpInst, L)) return nullptr;
9572
9572
9573
9573
PHINode *P = dyn_cast<PHINode>(OpInst);
9574
- if (!P)
9574
+ if (!P) {
9575
9575
// If this operand is already visited, reuse the prior result.
9576
9576
// We may have P != PHI if this is the deepest point at which the
9577
9577
// inconsistent paths meet.
9578
- P = PHIMap.lookup(OpInst);
9579
- if (!P) {
9580
9578
// Recurse and memoize the results, whether a phi is found or not.
9581
9579
// This recursive call invalidates pointers into PHIMap.
9582
- P = getConstantEvolvingPHIOperands(OpInst, L, PHIMap, Depth + 1);
9580
+ P = PHIMap.lookup_or(
9581
+ OpInst, getConstantEvolvingPHIOperands(OpInst, L, PHIMap, Depth + 1));
9583
9582
PHIMap[OpInst] = P;
9584
9583
}
9585
9584
if (!P)
@@ -15860,10 +15859,7 @@ const SCEV *ScalarEvolution::LoopGuards::rewrite(const SCEV *Expr) const {
15860
15859
const SCEV *visitAddRecExpr(const SCEVAddRecExpr *Expr) { return Expr; }
15861
15860
15862
15861
const SCEV *visitUnknown(const SCEVUnknown *Expr) {
15863
- auto I = Map.find(Expr);
15864
- if (I == Map.end())
15865
- return Expr;
15866
- return I->second;
15862
+ return Map.lookup_or(Expr, Expr);
15867
15863
}
15868
15864
15869
15865
const SCEV *visitZeroExtendExpr(const SCEVZeroExtendExpr *Expr) {
@@ -15891,25 +15887,19 @@ const SCEV *ScalarEvolution::LoopGuards::rewrite(const SCEV *Expr) const {
15891
15887
}
15892
15888
15893
15889
const SCEV *visitSignExtendExpr(const SCEVSignExtendExpr *Expr) {
15894
- auto I = Map.find(Expr);
15895
- if (I == Map.end())
15896
- return SCEVRewriteVisitor<SCEVLoopGuardRewriter>::visitSignExtendExpr(
15897
- Expr);
15898
- return I->second;
15890
+ return Map.lookup_or(
15891
+ Expr,
15892
+ SCEVRewriteVisitor<SCEVLoopGuardRewriter>::visitSignExtendExpr(Expr));
15899
15893
}
15900
15894
15901
15895
const SCEV *visitUMinExpr(const SCEVUMinExpr *Expr) {
15902
- auto I = Map.find(Expr);
15903
- if (I == Map.end())
15904
- return SCEVRewriteVisitor<SCEVLoopGuardRewriter>::visitUMinExpr(Expr);
15905
- return I->second;
15896
+ return Map.lookup_or(
15897
+ Expr, SCEVRewriteVisitor<SCEVLoopGuardRewriter>::visitUMinExpr(Expr));
15906
15898
}
15907
15899
15908
15900
const SCEV *visitSMinExpr(const SCEVSMinExpr *Expr) {
15909
- auto I = Map.find(Expr);
15910
- if (I == Map.end())
15911
- return SCEVRewriteVisitor<SCEVLoopGuardRewriter>::visitSMinExpr(Expr);
15912
- return I->second;
15901
+ return Map.lookup_or(
15902
+ Expr, SCEVRewriteVisitor<SCEVLoopGuardRewriter>::visitSMinExpr(Expr));
15913
15903
}
15914
15904
15915
15905
const SCEV *visitAddExpr(const SCEVAddExpr *Expr) {
0 commit comments