From e197ee9127cad226b0bb488a251a6ae08d160a34 Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Mon, 3 Mar 2025 07:42:28 -0800 Subject: [PATCH] [CodeGen] Avoid repeated hash lookups (NFC) --- llvm/lib/CodeGen/MachineBlockPlacement.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/llvm/lib/CodeGen/MachineBlockPlacement.cpp b/llvm/lib/CodeGen/MachineBlockPlacement.cpp index c61b8eb5e7b9c..9ccfadc318fa4 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;