Skip to content

Commit

Permalink
[AMDGPU] Avoid repeated hash lookups (NFC) (llvm#112115)
Browse files Browse the repository at this point in the history
  • Loading branch information
kazutakahirata authored and EricWF committed Oct 22, 2024
1 parent a97450c commit 5f970e3
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions llvm/lib/Target/AMDGPU/SIFormMemoryClauses.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,11 +227,9 @@ void SIFormMemoryClauses::collectRegUses(const MachineInstr &MI,
: LaneBitmask::getAll();
RegUse &Map = MO.isDef() ? Defs : Uses;

auto Loc = Map.find(Reg);
unsigned State = getMopState(MO);
if (Loc == Map.end()) {
Map[Reg] = std::pair(State, Mask);
} else {
auto [Loc, Inserted] = Map.try_emplace(Reg, State, Mask);
if (!Inserted) {
Loc->second.first |= State;
Loc->second.second |= Mask;
}
Expand Down

0 comments on commit 5f970e3

Please sign in to comment.