[llvm] [AMDGPU] Avoid repeated hash lookups (NFC) (PR #132511)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 21 20:52:52 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-backend-amdgpu
Author: Kazu Hirata (kazutakahirata)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/132511.diff
1 Files Affected:
- (modified) llvm/lib/Target/AMDGPU/GCNRegPressure.cpp (+4-4)
``````````diff
diff --git a/llvm/lib/Target/AMDGPU/GCNRegPressure.cpp b/llvm/lib/Target/AMDGPU/GCNRegPressure.cpp
index a438ad00bc41d..f74d12cfab0c0 100644
--- a/llvm/lib/Target/AMDGPU/GCNRegPressure.cpp
+++ b/llvm/lib/Target/AMDGPU/GCNRegPressure.cpp
@@ -692,8 +692,8 @@ GCNDownwardRPTracker::bumpDownwardPressure(const MachineInstr *MI,
if (LastUseMask.none())
continue;
- LaneBitmask LiveMask =
- LiveRegs.contains(Reg) ? LiveRegs.at(Reg) : LaneBitmask(0);
+ auto It = LiveRegs.find(Reg);
+ LaneBitmask LiveMask = It != LiveRegs.end() ? It->second : LaneBitmask(0);
LaneBitmask NewMask = LiveMask & ~LastUseMask;
TempPressure.inc(Reg, LiveMask, NewMask, *MRI);
}
@@ -703,8 +703,8 @@ GCNDownwardRPTracker::bumpDownwardPressure(const MachineInstr *MI,
Register Reg = Def.RegUnit;
if (!Reg.isVirtual())
continue;
- LaneBitmask LiveMask =
- LiveRegs.contains(Reg) ? LiveRegs.at(Reg) : LaneBitmask(0);
+ auto It = LiveRegs.find(Reg);
+ LaneBitmask LiveMask = It != LiveRegs.end() ? It->second : LaneBitmask(0);
LaneBitmask NewMask = LiveMask | Def.LaneMask;
TempPressure.inc(Reg, LiveMask, NewMask, *MRI);
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/132511
More information about the llvm-commits
mailing list