Skip to content

Commit b47849b

Browse files
[SCEV] Avoid repeated hash lookups (NFC) (#112656)
1 parent 9173fd7 commit b47849b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

llvm/lib/Analysis/ScalarEvolution.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9662,14 +9662,14 @@ Constant *
96629662
ScalarEvolution::getConstantEvolutionLoopExitValue(PHINode *PN,
96639663
const APInt &BEs,
96649664
const Loop *L) {
9665-
auto I = ConstantEvolutionLoopExitValue.find(PN);
9666-
if (I != ConstantEvolutionLoopExitValue.end())
9665+
auto [I, Inserted] = ConstantEvolutionLoopExitValue.try_emplace(PN);
9666+
if (!Inserted)
96679667
return I->second;
96689668

96699669
if (BEs.ugt(MaxBruteForceIterations))
9670-
return ConstantEvolutionLoopExitValue[PN] = nullptr; // Not going to evaluate it.
9670+
return nullptr; // Not going to evaluate it.
96719671

9672-
Constant *&RetVal = ConstantEvolutionLoopExitValue[PN];
9672+
Constant *&RetVal = I->second;
96739673

96749674
DenseMap<Instruction *, Constant *> CurrentIterVals;
96759675
BasicBlock *Header = L->getHeader();

0 commit comments

Comments
 (0)