Skip to content

Commit 4a8f414

Browse files
[Utils] Avoid repeated hash lookups (NFC) (#127959)
1 parent c612f79 commit 4a8f414

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

llvm/lib/Transforms/Utils/AssumeBundleBuilder.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -178,11 +178,9 @@ struct AssumeBuilderState {
178178
if (tryToPreserveWithoutAddingAssume(RK))
179179
return;
180180
MapKey Key{RK.WasOn, RK.AttrKind};
181-
auto Lookup = AssumedKnowledgeMap.find(Key);
182-
if (Lookup == AssumedKnowledgeMap.end()) {
183-
AssumedKnowledgeMap[Key] = RK.ArgValue;
181+
auto [Lookup, Inserted] = AssumedKnowledgeMap.try_emplace(Key, RK.ArgValue);
182+
if (Inserted)
184183
return;
185-
}
186184
assert(((Lookup->second == 0 && RK.ArgValue == 0) ||
187185
(Lookup->second != 0 && RK.ArgValue != 0)) &&
188186
"inconsistent argument value");

0 commit comments

Comments
 (0)