Skip to content

Commit 497506f

Browse files
[Analysis] Avoid repeated hash lookups (NFC) (#126678)
1 parent 43c82a8 commit 497506f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

llvm/lib/Analysis/DDG.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,9 +241,10 @@ bool DataDependenceGraph::addNode(DDGNode &N) {
241241
}
242242

243243
const PiBlockDDGNode *DataDependenceGraph::getPiBlock(const NodeType &N) const {
244-
if (!PiBlockMap.contains(&N))
244+
auto It = PiBlockMap.find(&N);
245+
if (It == PiBlockMap.end())
245246
return nullptr;
246-
auto *Pi = PiBlockMap.find(&N)->second;
247+
auto *Pi = It->second;
247248
assert(!PiBlockMap.contains(Pi) && "Nested pi-blocks detected.");
248249
return Pi;
249250
}

0 commit comments

Comments
 (0)