aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKazu Hirata <kazu@google.com>2025-03-04 01:49:48 -0800
committerGitHub <noreply@github.com>2025-03-04 01:49:48 -0800
commitef94d8a0f2d885d1753cd39c1ea76fe21a69d93b (patch)
tree52f30f854c8168efcd2d60d07f16dee16a9a8fa1
parent7a06681398a33d53ba6d661777be8b4c1d19acb7 (diff)
downloadllvm-ef94d8a0f2d885d1753cd39c1ea76fe21a69d93b.zip
llvm-ef94d8a0f2d885d1753cd39c1ea76fe21a69d93b.tar.gz
llvm-ef94d8a0f2d885d1753cd39c1ea76fe21a69d93b.tar.bz2
[CodeGen] Avoid repeated hash lookups (NFC) (#129652)
-rw-r--r--llvm/lib/CodeGen/MachineBlockPlacement.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/MachineBlockPlacement.cpp b/llvm/lib/CodeGen/MachineBlockPlacement.cpp
index c61b8eb..9ccfadc 100644
--- a/llvm/lib/CodeGen/MachineBlockPlacement.cpp
+++ b/llvm/lib/CodeGen/MachineBlockPlacement.cpp
@@ -1792,12 +1792,12 @@ MachineBasicBlock *MachineBlockPlacement::getFirstUnplacedBlock(
for (MachineFunction::iterator I = PrevUnplacedBlockIt, E = F->end(); I != E;
++I) {
- if (BlockToChain[&*I] != &PlacedChain) {
+ if (BlockChain *Chain = BlockToChain[&*I]; Chain != &PlacedChain) {
PrevUnplacedBlockIt = I;
// Now select the head of the chain to which the unplaced block belongs
// as the block to place. This will force the entire chain to be placed,
// and satisfies the requirements of merging chains.
- return *BlockToChain[&*I]->begin();
+ return *Chain->begin();
}
}
return nullptr;