[llvm] [ARM] Avoid repeated hash lookups (NFC) (PR #107356)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 4 23:32:44 PDT 2024
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/107356
None
>From c5fe5bc5a5a4fdd90f0a6c2b2c64cfa21b035732 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Wed, 4 Sep 2024 23:21:26 -0700
Subject: [PATCH] [ARM] Avoid repeated hash lookups (NFC)
---
llvm/lib/Target/ARM/ARMMachineFunctionInfo.h | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/llvm/lib/Target/ARM/ARMMachineFunctionInfo.h b/llvm/lib/Target/ARM/ARMMachineFunctionInfo.h
index b9ff3a08f998f6..54bf5fffd3942c 100644
--- a/llvm/lib/Target/ARM/ARMMachineFunctionInfo.h
+++ b/llvm/lib/Target/ARM/ARMMachineFunctionInfo.h
@@ -254,13 +254,9 @@ class ARMFunctionInfo : public MachineFunctionInfo {
return -1U;
}
- DenseMap<const MachineBasicBlock*, unsigned>::iterator getCoalescedWeight(
- MachineBasicBlock* MBB) {
- auto It = CoalescedWeights.find(MBB);
- if (It == CoalescedWeights.end()) {
- It = CoalescedWeights.insert(std::make_pair(MBB, 0)).first;
- }
- return It;
+ DenseMap<const MachineBasicBlock *, unsigned>::iterator
+ getCoalescedWeight(MachineBasicBlock *MBB) {
+ return CoalescedWeights.try_emplace(MBB, 0).first;
}
/// Indicate to the backend that \c GV has had its storage changed to inside
More information about the llvm-commits
mailing list