[llvm] [AMDGPU] Avoid repeated hash lookups (NFC) (PR #127573)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 17 22:45:08 PST 2025


https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/127573

None

>From 6c895205149713fed76e45061057816345e49cc0 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Mon, 17 Feb 2025 02:07:49 -0800
Subject: [PATCH] [AMDGPU] Avoid repeated hash lookups (NFC)

---
 llvm/lib/Target/AMDGPU/AMDGPUWaitSGPRHazards.cpp | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/llvm/lib/Target/AMDGPU/AMDGPUWaitSGPRHazards.cpp b/llvm/lib/Target/AMDGPU/AMDGPUWaitSGPRHazards.cpp
index e70d6aab306fe..9e2261b663dc9 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUWaitSGPRHazards.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUWaitSGPRHazards.cpp
@@ -384,13 +384,14 @@ class AMDGPUWaitSGPRHazards {
       }
     }
 
-    bool Changed = State != BlockState[&MBB].Out;
+    auto &BS = BlockState[&MBB];
+    bool Changed = State != BS.Out;
     if (Emit) {
       assert(!Changed && "Hazard state should not change on emit pass");
       return Emitted;
     }
     if (Changed)
-      BlockState[&MBB].Out = State;
+      BS.Out = State;
     return Changed;
   }
 



More information about the llvm-commits mailing list