[llvm] [IRSim] Avoid repeated hash lookups (NFC) (PR #108483)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 12 20:38:33 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-analysis
Author: Kazu Hirata (kazutakahirata)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/108483.diff
1 Files Affected:
- (modified) llvm/lib/Analysis/IRSimilarityIdentifier.cpp (+2-10)
``````````diff
diff --git a/llvm/lib/Analysis/IRSimilarityIdentifier.cpp b/llvm/lib/Analysis/IRSimilarityIdentifier.cpp
index 41815c633fdf2a..42e986e6179dd3 100644
--- a/llvm/lib/Analysis/IRSimilarityIdentifier.cpp
+++ b/llvm/lib/Analysis/IRSimilarityIdentifier.cpp
@@ -1420,16 +1420,8 @@ void IRSimilarityIdentifier::findCandidates(
// IRSimilarityCandidates that include that instruction.
for (IRSimilarityCandidate &IRCand : SimilarityCandidates->back()) {
for (unsigned Idx = IRCand.getStartIdx(), Edx = IRCand.getEndIdx();
- Idx <= Edx; ++Idx) {
- DenseMap<unsigned, DenseSet<IRSimilarityCandidate *>>::iterator
- IdIt;
- IdIt = IndexToIncludedCand.find(Idx);
- bool Inserted = false;
- if (IdIt == IndexToIncludedCand.end())
- std::tie(IdIt, Inserted) = IndexToIncludedCand.insert(
- std::make_pair(Idx, DenseSet<IRSimilarityCandidate *>()));
- IdIt->second.insert(&IRCand);
- }
+ Idx <= Edx; ++Idx)
+ IndexToIncludedCand[Idx].insert(&IRCand);
// Add mapping of candidate to the overall similarity group number.
CandToGroup.insert(
std::make_pair(&IRCand, SimilarityCandidates->size() - 1));
``````````
</details>
https://github.com/llvm/llvm-project/pull/108483
More information about the llvm-commits
mailing list