File tree Expand file tree Collapse file tree 1 file changed +4
-6
lines changed
llvm/lib/Transforms/Utils Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -206,13 +206,11 @@ PhiAnalyzer::PhiAnalyzer(const Loop &L, unsigned MaxIterations)
206
206
// G(%y) = Unknown otherwise (including phi not in header block)
207
207
PhiAnalyzer::PeelCounter PhiAnalyzer::calculate (const Value &V) {
208
208
// If we already know the answer, take it from the map.
209
- auto I = IterationsToInvariance.find (&V);
210
- if (I != IterationsToInvariance.end ())
211
- return I->second ;
212
-
213
- // Place Unknown to map to avoid infinite recursion. Such
209
+ // Otherwise, place Unknown to map to avoid infinite recursion. Such
214
210
// cycles can never stop on an invariant.
215
- IterationsToInvariance[&V] = Unknown;
211
+ auto [I, Inserted] = IterationsToInvariance.try_emplace (&V, Unknown);
212
+ if (!Inserted)
213
+ return I->second ;
216
214
217
215
if (L.isLoopInvariant (&V))
218
216
// Loop invariant so known at start.
You can’t perform that action at this time.
0 commit comments