[llvm] [Analysis] Avoid repeated hash lookups (NFC) (PR #126402)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Sun Feb 9 00:20:28 PST 2025


================
@@ -241,8 +241,8 @@ template <class G> void AbstractDependenceGraphBuilder<G>::createDefUseEdges() {
         if (!UI)
           continue;
         NodeType *DstNode = nullptr;
-        if (IMap.find(UI) != IMap.end())
-          DstNode = IMap.find(UI)->second;
+        if (auto It = IMap.find(UI); It != IMap.end())
+          DstNode = It->second;
----------------
nikic wrote:

Use lookup()?

https://github.com/llvm/llvm-project/pull/126402


More information about the llvm-commits mailing list