Skip to content

Commit 3c2731c

Browse files
[AMDGPU] Avoid repeated hash lookups (NFC) (#132657)
1 parent ef3e521 commit 3c2731c

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1743,10 +1743,12 @@ bool SIInsertWaitcnts::generateWaitcntInstBefore(MachineInstr &MI,
17431743

17441744
for (const MachineMemOperand *Memop : MI.memoperands()) {
17451745
const Value *Ptr = Memop->getValue();
1746-
if (Memop->isStore() && SLoadAddresses.count(Ptr)) {
1747-
addWait(Wait, SmemAccessCounter, 0);
1748-
if (PDT->dominates(MI.getParent(), SLoadAddresses.find(Ptr)->second))
1749-
SLoadAddresses.erase(Ptr);
1746+
if (Memop->isStore()) {
1747+
if (auto It = SLoadAddresses.find(Ptr); It != SLoadAddresses.end()) {
1748+
addWait(Wait, SmemAccessCounter, 0);
1749+
if (PDT->dominates(MI.getParent(), It->second))
1750+
SLoadAddresses.erase(It);
1751+
}
17501752
}
17511753
unsigned AS = Memop->getAddrSpace();
17521754
if (AS != AMDGPUAS::LOCAL_ADDRESS && AS != AMDGPUAS::FLAT_ADDRESS)

0 commit comments

Comments
 (0)