[llvm] e1e696d - [Scalar] Avoid repeated hash lookups (NFC) (#168217)

via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 16 08:09:25 PST 2025


Author: Kazu Hirata
Date: 2025-11-16T08:09:21-08:00
New Revision: e1e696d2eb0f4467133275ff6a2661f389dd3dbe

URL: https://github.com/llvm/llvm-project/commit/e1e696d2eb0f4467133275ff6a2661f389dd3dbe
DIFF: https://github.com/llvm/llvm-project/commit/e1e696d2eb0f4467133275ff6a2661f389dd3dbe.diff

LOG: [Scalar] Avoid repeated hash lookups (NFC) (#168217)

Added: 
    

Modified: 
    llvm/lib/Transforms/Scalar/StraightLineStrengthReduce.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Scalar/StraightLineStrengthReduce.cpp b/llvm/lib/Transforms/Scalar/StraightLineStrengthReduce.cpp
index a62804d3ef201..e5399bdd767e2 100644
--- a/llvm/lib/Transforms/Scalar/StraightLineStrengthReduce.cpp
+++ b/llvm/lib/Transforms/Scalar/StraightLineStrengthReduce.cpp
@@ -1275,8 +1275,7 @@ bool StraightLineStrengthReduce::runOnFunction(Function &F) {
   // Build the dependency graph and sort candidate instructions from dependency
   // roots to leaves
   for (auto &C : Candidates) {
-    if (DependencyGraph.find(C.Ins) == DependencyGraph.end())
-      DependencyGraph[C.Ins] = {};
+    DependencyGraph.try_emplace(C.Ins);
     addDependency(C, C.Basis);
   }
   sortCandidateInstructions();


        


More information about the llvm-commits mailing list