Skip to content

Commit a5e969a

Browse files
[CodeGen] Avoid repeated hash lookups (NFC) (#125382)
1 parent 09e7b40 commit a5e969a

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

llvm/lib/CodeGen/InlineSpiller.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1532,10 +1532,12 @@ void HoistSpillHelper::runHoistSpills(
15321532
MachineBasicBlock *Block = (*RIt)->getBlock();
15331533

15341534
// If Block contains an original spill, simply continue.
1535-
if (SpillsToKeep.contains(*RIt) && !SpillsToKeep[*RIt]) {
1536-
SpillsInSubTreeMap[*RIt].first.insert(*RIt);
1537-
// SpillsInSubTreeMap[*RIt].second contains the cost of spill.
1538-
SpillsInSubTreeMap[*RIt].second = MBFI.getBlockFreq(Block);
1535+
if (auto It = SpillsToKeep.find(*RIt);
1536+
It != SpillsToKeep.end() && !It->second) {
1537+
auto &SIt = SpillsInSubTreeMap[*RIt];
1538+
SIt.first.insert(*RIt);
1539+
// Sit.second contains the cost of spill.
1540+
SIt.second = MBFI.getBlockFreq(Block);
15391541
continue;
15401542
}
15411543

0 commit comments

Comments
 (0)