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

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 6 20:47:24 PST 2025


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

None

>From 81e6021eff9633437fb0ab1551ca5c868247a4f1 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Thu, 6 Mar 2025 09:03:32 -0800
Subject: [PATCH] [AMDGPU] Avoid repeated hash lookups (NFC)

---
 llvm/lib/Target/AMDGPU/AMDGPUInsertDelayAlu.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/llvm/lib/Target/AMDGPU/AMDGPUInsertDelayAlu.cpp b/llvm/lib/Target/AMDGPU/AMDGPUInsertDelayAlu.cpp
index b3e371cdff8fd..b25619b4c5422 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUInsertDelayAlu.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUInsertDelayAlu.cpp
@@ -400,8 +400,8 @@ class AMDGPUInsertDelayAlu {
     if (Emit) {
       assert(State == BlockState[&MBB] &&
              "Basic block state should not have changed on final pass!");
-    } else if (State != BlockState[&MBB]) {
-      BlockState[&MBB] = std::move(State);
+    } else if (DelayState &BS = BlockState[&MBB]; State != BS) {
+      BS = std::move(State);
       Changed = true;
     }
     return Changed;



More information about the llvm-commits mailing list