Skip to content

[X86] Avoid repeated hash lookups (NFC) #126006

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions llvm/lib/Target/X86/X86AvoidStoreForwardingBlocks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -625,13 +625,10 @@ static bool isBlockingStore(int64_t LoadDispImm, unsigned LoadSize,
static void
updateBlockingStoresDispSizeMap(DisplacementSizeMap &BlockingStoresDispSizeMap,
int64_t DispImm, unsigned Size) {
if (BlockingStoresDispSizeMap.count(DispImm)) {
// Choose the smallest blocking store starting at this displacement.
if (BlockingStoresDispSizeMap[DispImm] > Size)
BlockingStoresDispSizeMap[DispImm] = Size;

} else
BlockingStoresDispSizeMap[DispImm] = Size;
auto [It, Inserted] = BlockingStoresDispSizeMap.try_emplace(DispImm, Size);
// Choose the smallest blocking store starting at this displacement.
if (!Inserted && It->second > Size)
It->second = Size;
}

// Remove blocking stores contained in each other.
Expand Down