[llvm] [Hexagon] Avoid repeated hash lookups (NFC) (PR #131496)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Sat Mar 15 21:25:32 PDT 2025
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/131496
None
>From 20f1e8733aaad0f6692a059c1e700188acc8e263 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Sat, 15 Mar 2025 09:20:01 -0700
Subject: [PATCH] [Hexagon] Avoid repeated hash lookups (NFC)
---
llvm/lib/Target/Hexagon/HexagonSubtarget.cpp | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
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