[llvm] [Scalar] Avoid repeated hash lookups (NFC) (PR #168217)
via llvm-commits
llvm-commits at lists.llvm.org
Sat Nov 15 09:41:10 PST 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-transforms
Author: Kazu Hirata (kazutakahirata)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/168217.diff
1 Files Affected:
- (modified) llvm/lib/Transforms/Scalar/StraightLineStrengthReduce.cpp (+1-2)
``````````diff
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();
``````````
</details>
https://github.com/llvm/llvm-project/pull/168217
More information about the llvm-commits
mailing list