Skip to content

Commit

Permalink
[SLP] Avoid repeated hash lookups (NFC) (llvm#115428)
Browse files Browse the repository at this point in the history
  • Loading branch information
kazutakahirata authored Nov 8, 2024
1 parent a4819d6 commit bc7e5c2
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2241,10 +2241,9 @@ class BoUpSLP {
HashMap[NumFreeOpsHash.Hash] = std::make_pair(1, Lane);
} else if (NumFreeOpsHash.NumOfAPOs == Min &&
NumFreeOpsHash.NumOpsWithSameOpcodeParent == SameOpNumber) {
auto *It = HashMap.find(NumFreeOpsHash.Hash);
if (It == HashMap.end())
HashMap[NumFreeOpsHash.Hash] = std::make_pair(1, Lane);
else
auto [It, Inserted] =
HashMap.try_emplace(NumFreeOpsHash.Hash, 1, Lane);
if (!Inserted)
++It->second.first;
}
}
Expand Down

0 comments on commit bc7e5c2

Please sign in to comment.