Skip to content

Commit 2130b9c

Browse files
[Coroutines] Avoid repeated hash lookups (NFC) (#127956)
1 parent a6eb7d6 commit 2130b9c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

llvm/lib/Transforms/Coroutines/MaterializationUtils.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,8 @@ void coro::doRematerializations(
293293
for (Instruction *U : E.second) {
294294
// Don't process a user twice (this can happen if the instruction uses
295295
// more than one rematerializable def)
296-
if (AllRemats.count(U))
296+
auto [It, Inserted] = AllRemats.try_emplace(U);
297+
if (!Inserted)
297298
continue;
298299

299300
// Constructor creates the whole RematGraph for the given Use
@@ -306,7 +307,7 @@ void coro::doRematerializations(
306307
++I) { (*I)->Node->dump(); } dbgs()
307308
<< "\n";);
308309

309-
AllRemats[U] = std::move(RematUPtr);
310+
It->second = std::move(RematUPtr);
310311
}
311312
}
312313

0 commit comments

Comments
 (0)