[llvm] aea3b0f - [ARM] Avoid repeated hash lookups (NFC) (#107356)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 5 08:35:23 PDT 2024
Author: Kazu Hirata
Date: 2024-09-05T08:35:18-07:00
New Revision: aea3b0f6838bd8268fc3653e1b662d771c87ab15
URL: https://github.com/llvm/llvm-project/commit/aea3b0f6838bd8268fc3653e1b662d771c87ab15
DIFF: https://github.com/llvm/llvm-project/commit/aea3b0f6838bd8268fc3653e1b662d771c87ab15.diff
LOG: [ARM] Avoid repeated hash lookups (NFC) (#107356)
Added:
Modified:
llvm/lib/Target/ARM/ARMMachineFunctionInfo.h
Removed:
################################################################################
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