[llvm] 48ecec2 - [Hexagon] Avoid repeated hash lookups (NFC) (#131496)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Mar 16 09:29:38 PDT 2025
Author: Kazu Hirata
Date: 2025-03-16T09:29:35-07:00
New Revision: 48ecec20a2048689e53007ce4b929a7d6a9a3b17
URL: https://github.com/llvm/llvm-project/commit/48ecec20a2048689e53007ce4b929a7d6a9a3b17
DIFF: https://github.com/llvm/llvm-project/commit/48ecec20a2048689e53007ce4b929a7d6a9a3b17.diff
LOG: [Hexagon] Avoid repeated hash lookups (NFC) (#131496)
Added:
Modified:
llvm/lib/Target/Hexagon/HexagonSubtarget.cpp
Removed:
################################################################################
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);
+ }
}
}
}
More information about the llvm-commits
mailing list