Skip to content

Commit bc7e5c2

Browse files
[SLP] Avoid repeated hash lookups (NFC) (#115428)
1 parent a4819d6 commit bc7e5c2

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2241,10 +2241,9 @@ class BoUpSLP {
22412241
HashMap[NumFreeOpsHash.Hash] = std::make_pair(1, Lane);
22422242
} else if (NumFreeOpsHash.NumOfAPOs == Min &&
22432243
NumFreeOpsHash.NumOpsWithSameOpcodeParent == SameOpNumber) {
2244-
auto *It = HashMap.find(NumFreeOpsHash.Hash);
2245-
if (It == HashMap.end())
2246-
HashMap[NumFreeOpsHash.Hash] = std::make_pair(1, Lane);
2247-
else
2244+
auto [It, Inserted] =
2245+
HashMap.try_emplace(NumFreeOpsHash.Hash, 1, Lane);
2246+
if (!Inserted)
22482247
++It->second.first;
22492248
}
22502249
}

0 commit comments

Comments
 (0)