[llvm] [CodeGen] Avoid repeated hash lookups (NFC) (PR #125382)
via llvm-commits
llvm-commits at lists.llvm.org
Sat Feb 1 21:14:10 PST 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-regalloc
Author: Kazu Hirata (kazutakahirata)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/125382.diff
1 Files Affected:
- (modified) llvm/lib/CodeGen/InlineSpiller.cpp (+6-4)
``````````diff
diff --git a/llvm/lib/CodeGen/InlineSpiller.cpp b/llvm/lib/CodeGen/InlineSpiller.cpp
index cfd247e7c3caf6..302dd37ff3d67b 100644
--- a/llvm/lib/CodeGen/InlineSpiller.cpp
+++ b/llvm/lib/CodeGen/InlineSpiller.cpp
@@ -1532,10 +1532,12 @@ void HoistSpillHelper::runHoistSpills(
MachineBasicBlock *Block = (*RIt)->getBlock();
// If Block contains an original spill, simply continue.
- if (SpillsToKeep.contains(*RIt) && !SpillsToKeep[*RIt]) {
- SpillsInSubTreeMap[*RIt].first.insert(*RIt);
- // SpillsInSubTreeMap[*RIt].second contains the cost of spill.
- SpillsInSubTreeMap[*RIt].second = MBFI.getBlockFreq(Block);
+ if (auto It = SpillsToKeep.find(*RIt);
+ It != SpillsToKeep.end() && !It->second) {
+ auto &SIt = SpillsInSubTreeMap[*RIt];
+ SIt.first.insert(*RIt);
+ // Sit.second contains the cost of spill.
+ SIt.second = MBFI.getBlockFreq(Block);
continue;
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/125382
More information about the llvm-commits
mailing list