[llvm] [Hexagon] Avoid repeated hash lookups (NFC) (PR #131496)
via llvm-commits
llvm-commits at lists.llvm.org
Sat Mar 15 21:26:03 PDT 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/131496.diff
1 Files Affected:
- (modified) llvm/lib/Target/Hexagon/HexagonSubtarget.cpp (+7-5)
``````````diff
diff --git a/llvm/lib/Target/Hexagon/HexagonSubtarget.cpp b/llvm/lib/Target/Hexagon/HexagonSubtarget.cpp
index ffe9ce750bf50..723a00208ccc0 100644
--- a/llvm/lib/Target/Hexagon/HexagonSubtarget.cpp
+++ b/llvm/lib/Target/Hexagon/HexagonSubtarget.cpp
@@ -361,11 +361,13 @@ void HexagonSubtarget::CallMutation::apply(ScheduleDAGInstrs *DAGInstrs) {
} else if (MO.isDef() && MO.getReg().isPhysical()) {
for (MCRegAliasIterator AI(MO.getReg(), &TRI, true); AI.isValid();
++AI) {
- if (LastVRegUse.count(*AI) &&
- LastVRegUse[*AI] != &DAG->SUnits[su])
- // %r0 = ...
- DAG->addEdge(&DAG->SUnits[su], SDep(LastVRegUse[*AI], SDep::Barrier));
- LastVRegUse.erase(*AI);
+ if (auto It = LastVRegUse.find(*AI); It != LastVRegUse.end()) {
+ if (It->second != &DAG->SUnits[su])
+ // %r0 = ...
+ DAG->addEdge(&DAG->SUnits[su],
+ SDep(It->second, SDep::Barrier));
+ LastVRegUse.erase(It);
+ }
}
}
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/131496
More information about the llvm-commits
mailing list