[llvm] [Hexagon] Avoid repeated hash lookups (NFC) (PR #129357)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 28 20:12:41 PST 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-backend-hexagon
Author: Kazu Hirata (kazutakahirata)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/129357.diff
1 Files Affected:
- (modified) llvm/lib/Target/Hexagon/HexagonCopyHoisting.cpp (+3-2)
``````````diff
diff --git a/llvm/lib/Target/Hexagon/HexagonCopyHoisting.cpp b/llvm/lib/Target/Hexagon/HexagonCopyHoisting.cpp
index 59c882bf37afa..7c18c524d2d64 100644
--- a/llvm/lib/Target/Hexagon/HexagonCopyHoisting.cpp
+++ b/llvm/lib/Target/Hexagon/HexagonCopyHoisting.cpp
@@ -180,14 +180,15 @@ bool HexagonCopyHoisting::analyzeCopy(MachineBasicBlock *BB) {
bool IsSafetoMove = true;
for (MachineBasicBlock *SuccBB : BB->successors()) {
auto &SuccBBCopyInst = CopyMIList[SuccBB->getNumber()];
- if (!SuccBBCopyInst.count(Key)) {
+ auto It = SuccBBCopyInst.find(Key);
+ if (It == SuccBBCopyInst.end()) {
// Same copy not present in this successor
IsSafetoMove = false;
break;
}
// If present, make sure that it's safe to pull this copy instruction
// into the predecessor.
- MachineInstr *SuccMI = SuccBBCopyInst[Key];
+ MachineInstr *SuccMI = It->second;
if (!isSafetoMove(SuccMI)) {
IsSafetoMove = false;
break;
``````````
</details>
https://github.com/llvm/llvm-project/pull/129357
More information about the llvm-commits
mailing list