Skip to content

Commit 7ae8b4b

Browse files
kazutakahiratavar-const
authored andcommitted
[CodeGen] Avoid repeated hash lookups (NFC) (llvm#135584)
1 parent cd04652 commit 7ae8b4b

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

llvm/lib/CodeGen/MachineBlockPlacement.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1132,11 +1132,13 @@ MachineBlockPlacement::getBestTrellisSuccessor(
11321132
for (auto *Succ : ViableSuccs) {
11331133
for (MachineBasicBlock *SuccPred : Succ->predecessors()) {
11341134
// Skip any placed predecessors that are not BB
1135-
if (SuccPred != BB)
1136-
if ((BlockFilter && !BlockFilter->count(SuccPred)) ||
1137-
BlockToChain[SuccPred] == &Chain ||
1138-
BlockToChain[SuccPred] == BlockToChain[Succ])
1135+
if (SuccPred != BB) {
1136+
if (BlockFilter && !BlockFilter->count(SuccPred))
11391137
continue;
1138+
const BlockChain *SuccPredChain = BlockToChain[SuccPred];
1139+
if (SuccPredChain == &Chain || SuccPredChain == BlockToChain[Succ])
1140+
continue;
1141+
}
11401142
BlockFrequency EdgeFreq = MBFI->getBlockFreq(SuccPred) *
11411143
MBPI->getEdgeProbability(SuccPred, Succ);
11421144
Edges[SuccIndex].push_back({EdgeFreq, SuccPred, Succ});

0 commit comments

Comments
 (0)