[llvm] [ARM] Avoid repeated hash lookups (NFC) (PR #107356)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 4 23:33:17 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-backend-arm
Author: Kazu Hirata (kazutakahirata)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/107356.diff
1 Files Affected:
- (modified) llvm/lib/Target/ARM/ARMMachineFunctionInfo.h (+3-7)
``````````diff
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
``````````
</details>
https://github.com/llvm/llvm-project/pull/107356
More information about the llvm-commits
mailing list