Skip to content

Commit ff94b03

Browse files
[X86] Avoid repeated hash lookups (NFC) (llvm#126006)
1 parent 91c188b commit ff94b03

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

llvm/lib/Target/X86/X86AvoidStoreForwardingBlocks.cpp

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -625,13 +625,10 @@ static bool isBlockingStore(int64_t LoadDispImm, unsigned LoadSize,
625625
static void
626626
updateBlockingStoresDispSizeMap(DisplacementSizeMap &BlockingStoresDispSizeMap,
627627
int64_t DispImm, unsigned Size) {
628-
if (BlockingStoresDispSizeMap.count(DispImm)) {
629-
// Choose the smallest blocking store starting at this displacement.
630-
if (BlockingStoresDispSizeMap[DispImm] > Size)
631-
BlockingStoresDispSizeMap[DispImm] = Size;
632-
633-
} else
634-
BlockingStoresDispSizeMap[DispImm] = Size;
628+
auto [It, Inserted] = BlockingStoresDispSizeMap.try_emplace(DispImm, Size);
629+
// Choose the smallest blocking store starting at this displacement.
630+
if (!Inserted && It->second > Size)
631+
It->second = Size;
635632
}
636633

637634
// Remove blocking stores contained in each other.

0 commit comments

Comments
 (0)