[llvm] [AMDGPU] Avoid repeated hash lookups (NFC) (PR #128458)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Sun Feb 23 21:18:23 PST 2025
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/128458
None
>From 283a03c2d24f42b97c136aa50772ea4fc301c1a5 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Sun, 23 Feb 2025 09:03:38 -0800
Subject: [PATCH] [AMDGPU] Avoid repeated hash lookups (NFC)
---
llvm/lib/Target/AMDGPU/AMDGPURewriteOutArguments.cpp | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/llvm/lib/Target/AMDGPU/AMDGPURewriteOutArguments.cpp b/llvm/lib/Target/AMDGPU/AMDGPURewriteOutArguments.cpp
index 5087f1a902456..6347636b60e58 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPURewriteOutArguments.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPURewriteOutArguments.cpp
@@ -376,10 +376,11 @@ bool AMDGPURewriteOutArguments::runOnFunction(Function &F) {
int RetIdx = RetTy->isVoidTy() ? 0 : 1;
for (Argument &Arg : F.args()) {
- if (!OutArgIndexes.count(Arg.getArgNo()))
+ auto It = OutArgIndexes.find(Arg.getArgNo());
+ if (It == OutArgIndexes.end())
continue;
- Type *EltTy = OutArgIndexes[Arg.getArgNo()];
+ Type *EltTy = It->second;
const auto Align =
DL->getValueOrABITypeAlignment(Arg.getParamAlign(), EltTy);
More information about the llvm-commits
mailing list