diff options
author | Kazu Hirata <kazu@google.com> | 2025-03-23 22:30:09 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-03-23 22:30:09 -0700 |
commit | 3c2731ce46f01a984a9cc1807207de8d333bc350 (patch) | |
tree | ab1ddb405d29351cee4d0843951fefcb4a767f0d | |
parent | ef3e521a2b34050d92a6b711c5df811a0bde84f4 (diff) | |
download | llvm-3c2731ce46f01a984a9cc1807207de8d333bc350.zip llvm-3c2731ce46f01a984a9cc1807207de8d333bc350.tar.gz llvm-3c2731ce46f01a984a9cc1807207de8d333bc350.tar.bz2 |
[AMDGPU] Avoid repeated hash lookups (NFC) (#132657)
-rw-r--r-- | llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp b/llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp index eafa324..5906b1c 100644 --- a/llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp +++ b/llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp @@ -1743,10 +1743,12 @@ bool SIInsertWaitcnts::generateWaitcntInstBefore(MachineInstr &MI, for (const MachineMemOperand *Memop : MI.memoperands()) { const Value *Ptr = Memop->getValue(); - if (Memop->isStore() && SLoadAddresses.count(Ptr)) { - addWait(Wait, SmemAccessCounter, 0); - if (PDT->dominates(MI.getParent(), SLoadAddresses.find(Ptr)->second)) - SLoadAddresses.erase(Ptr); + if (Memop->isStore()) { + if (auto It = SLoadAddresses.find(Ptr); It != SLoadAddresses.end()) { + addWait(Wait, SmemAccessCounter, 0); + if (PDT->dominates(MI.getParent(), It->second)) + SLoadAddresses.erase(It); + } } unsigned AS = Memop->getAddrSpace(); if (AS != AMDGPUAS::LOCAL_ADDRESS && AS != AMDGPUAS::FLAT_ADDRESS) |