[llvm] [AArch64] Avoid repeated hash lookups (NFC) (PR #130542)

via llvm-commits llvm-commits at lists.llvm.org
Sun Mar 9 20:50:30 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-backend-aarch64

Author: Kazu Hirata (kazutakahirata)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/130542.diff


1 Files Affected:

- (modified) llvm/lib/Target/AArch64/AArch64FastISel.cpp (+2-4) 


``````````diff
diff --git a/llvm/lib/Target/AArch64/AArch64FastISel.cpp b/llvm/lib/Target/AArch64/AArch64FastISel.cpp
index 8961283fe7449..5ef439f8224c1 100644
--- a/llvm/lib/Target/AArch64/AArch64FastISel.cpp
+++ b/llvm/lib/Target/AArch64/AArch64FastISel.cpp
@@ -346,12 +346,10 @@ Register AArch64FastISel::fastMaterializeAlloca(const AllocaInst *AI) {
          "Alloca should always return a pointer.");
 
   // Don't handle dynamic allocas.
-  if (!FuncInfo.StaticAllocaMap.count(AI))
+  auto SI = FuncInfo.StaticAllocaMap.find(AI);
+  if (SI == FuncInfo.StaticAllocaMap.end())
     return Register();
 
-  DenseMap<const AllocaInst *, int>::iterator SI =
-      FuncInfo.StaticAllocaMap.find(AI);
-
   if (SI != FuncInfo.StaticAllocaMap.end()) {
     Register ResultReg = createResultReg(&AArch64::GPR64spRegClass);
     BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, MIMD, TII.get(AArch64::ADDXri),

``````````

</details>


https://github.com/llvm/llvm-project/pull/130542


More information about the llvm-commits mailing list