[Passes] Avoid repeated hash lookups (NFC) (#135542)

This commit is contained in:
Kazu Hirata 2025-04-13 05:46:29 -07:00 committed by GitHub
parent 4b4cd645a8
commit d1d5f00a8e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2001,14 +2001,12 @@ DotCfgDiff::DotCfgDiff(StringRef Title, const FuncDataT<DCData> &Before,
for (auto &A : After.getData()) {
StringRef Label = A.getKey();
const BlockDataT<DCData> &BD = A.getValue();
unsigned C = NodePosition.count(Label);
if (C == 0)
auto It = NodePosition.find(Label);
if (It == NodePosition.end())
// This only exists in the after IR. Create the node.
createNode(Label, BD, AfterColour);
else {
assert(C == 1 && "Unexpected multiple nodes.");
Nodes[NodePosition[Label]].setCommon(BD);
}
else
Nodes[It->second].setCommon(BD);
// Add in the edges between the nodes (as common or only in after).
for (StringMap<std::string>::const_iterator Sink = BD.getData().begin(),
E = BD.getData().end();