Skip to content

Commit 07fe365

Browse files
kazutakahirataIcohedron
authored andcommitted
[Coroutines] Avoid repeated hash lookups (NFC) (llvm#126432)
1 parent b11c69e commit 07fe365

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

llvm/lib/Transforms/Coroutines/CoroFrame.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -752,13 +752,14 @@ static void buildFrameDebugInfo(Function &F, coro::Shape &Shape,
752752
dwarf::DW_ATE_unsigned_char)});
753753

754754
for (auto *V : FrameData.getAllDefs()) {
755-
if (!DIVarCache.contains(V))
755+
auto It = DIVarCache.find(V);
756+
if (It == DIVarCache.end())
756757
continue;
757758

758759
auto Index = FrameData.getFieldIndex(V);
759760

760-
NameCache.insert({Index, DIVarCache[V]->getName()});
761-
TyCache.insert({Index, DIVarCache[V]->getType()});
761+
NameCache.insert({Index, It->second->getName()});
762+
TyCache.insert({Index, It->second->getType()});
762763
}
763764

764765
// Cache from index to (Align, Offset Pair)

0 commit comments

Comments
 (0)