Skip to content

Commit ab06a18

Browse files
[IRSim] Avoid repeated hash lookups (NFC) (#108483)
1 parent 974fa85 commit ab06a18

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

llvm/lib/Analysis/IRSimilarityIdentifier.cpp

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1420,16 +1420,8 @@ void IRSimilarityIdentifier::findCandidates(
14201420
// IRSimilarityCandidates that include that instruction.
14211421
for (IRSimilarityCandidate &IRCand : SimilarityCandidates->back()) {
14221422
for (unsigned Idx = IRCand.getStartIdx(), Edx = IRCand.getEndIdx();
1423-
Idx <= Edx; ++Idx) {
1424-
DenseMap<unsigned, DenseSet<IRSimilarityCandidate *>>::iterator
1425-
IdIt;
1426-
IdIt = IndexToIncludedCand.find(Idx);
1427-
bool Inserted = false;
1428-
if (IdIt == IndexToIncludedCand.end())
1429-
std::tie(IdIt, Inserted) = IndexToIncludedCand.insert(
1430-
std::make_pair(Idx, DenseSet<IRSimilarityCandidate *>()));
1431-
IdIt->second.insert(&IRCand);
1432-
}
1423+
Idx <= Edx; ++Idx)
1424+
IndexToIncludedCand[Idx].insert(&IRCand);
14331425
// Add mapping of candidate to the overall similarity group number.
14341426
CandToGroup.insert(
14351427
std::make_pair(&IRCand, SimilarityCandidates->size() - 1));

0 commit comments

Comments
 (0)