[llvm] [AMDGPU] Avoid repeated hash lookups (NFC) (PR #126430)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Sun Feb 9 11:44:56 PST 2025
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/126430
None
>From e2695d351e759781b5c0c81827c3a219c84356ff Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Sun, 9 Feb 2025 09:13:42 -0800
Subject: [PATCH] [AMDGPU] Avoid repeated hash lookups (NFC)
---
llvm/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp b/llvm/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp
index 28a27ffc136776b..69ddb384e1a400e 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp
@@ -839,10 +839,9 @@ bool AMDGPUPromoteAllocaImpl::tryPromoteAllocaToVector(AllocaInst &Alloca) {
return RejectUser(Inst, "mem transfer inst length is non-constant or "
"not a multiple of the vector element size");
- if (!TransferInfo.count(TransferInst)) {
+ if (TransferInfo.try_emplace(TransferInst).second) {
DeferredInsts.push_back(Inst);
WorkList.push_back(Inst);
- TransferInfo[TransferInst] = MemTransferInfo();
}
auto getPointerIndexOfAlloca = [&](Value *Ptr) -> ConstantInt * {
More information about the llvm-commits
mailing list