Skip to content

Commit 3d15bfb

Browse files
[CodeGen] Avoid repeated hash lookups (NFC) (#123500)
1 parent f13850a commit 3d15bfb

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

llvm/lib/CodeGen/FixupStatepointCallerSaved.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,8 @@ class RegReloadCache {
190190
// Does basic block MBB contains reload of Reg from FI?
191191
bool hasReload(Register Reg, int FI, const MachineBasicBlock *MBB) {
192192
RegSlotPair RSP(Reg, FI);
193-
return Reloads.count(MBB) && Reloads[MBB].count(RSP);
193+
auto It = Reloads.find(MBB);
194+
return It != Reloads.end() && It->second.count(RSP);
194195
}
195196
};
196197

@@ -242,9 +243,10 @@ class FrameIndexesCache {
242243
It.second.Index = 0;
243244

244245
ReservedSlots.clear();
245-
if (EHPad && GlobalIndices.count(EHPad))
246-
for (auto &RSP : GlobalIndices[EHPad])
247-
ReservedSlots.insert(RSP.second);
246+
if (EHPad)
247+
if (auto It = GlobalIndices.find(EHPad); It != GlobalIndices.end())
248+
for (auto &RSP : It->second)
249+
ReservedSlots.insert(RSP.second);
248250
}
249251

250252
// Get frame index to spill the register.

0 commit comments

Comments
 (0)