Skip to content

Commit 2f88672

Browse files
[Coroutines] Avoid repeated hash lookups (NFC) (#126466)
1 parent de56395 commit 2f88672

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
@@ -70,11 +70,12 @@ struct RematGraph {
7070
std::deque<std::unique_ptr<RematNode>> &WorkList,
7171
User *FirstUse) {
7272
RematNode *N = NUPtr.get();
73-
if (Remats.count(N->Node))
73+
auto [It, Inserted] = Remats.try_emplace(N->Node);
74+
if (!Inserted)
7475
return;
7576

7677
// We haven't see this node yet - add to the list
77-
Remats[N->Node] = std::move(NUPtr);
78+
It->second = std::move(NUPtr);
7879
for (auto &Def : N->Node->operands()) {
7980
Instruction *D = dyn_cast<Instruction>(Def.get());
8081
if (!D || !MaterializableCallback(*D) ||

0 commit comments

Comments
 (0)