Skip to content

Commit 48bccee

Browse files
[Hexagon] Avoid repeated hash lookups (NFC) (llvm#128302)
1 parent 94b8106 commit 48bccee

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

llvm/lib/Target/Hexagon/HexagonFrameLowering.cpp

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2281,18 +2281,20 @@ void HexagonFrameLowering::optimizeSpillSlots(MachineFunction &MF,
22812281
continue;
22822282

22832283
IndexType Index = IndexMap.getIndex(&In);
2284+
auto &LS = LastStore[FI];
2285+
auto &LL = LastLoad[FI];
22842286
if (Load) {
2285-
if (LastStore[FI] == IndexType::None)
2286-
LastStore[FI] = IndexType::Entry;
2287-
LastLoad[FI] = Index;
2287+
if (LS == IndexType::None)
2288+
LS = IndexType::Entry;
2289+
LL = Index;
22882290
} else if (Store) {
22892291
HexagonBlockRanges::RangeList &RL = FIRangeMap[FI].Map[&B];
2290-
if (LastStore[FI] != IndexType::None)
2291-
RL.add(LastStore[FI], LastLoad[FI], false, false);
2292-
else if (LastLoad[FI] != IndexType::None)
2293-
RL.add(IndexType::Entry, LastLoad[FI], false, false);
2294-
LastLoad[FI] = IndexType::None;
2295-
LastStore[FI] = Index;
2292+
if (LS != IndexType::None)
2293+
RL.add(LS, LL, false, false);
2294+
else if (LL != IndexType::None)
2295+
RL.add(IndexType::Entry, LL, false, false);
2296+
LL = IndexType::None;
2297+
LS = Index;
22962298
} else {
22972299
BadFIs.insert(FI);
22982300
}

0 commit comments

Comments
 (0)