[llvm] [CodeLayout] Size-aware machine block placement (PR #109711)
Ellis Hoag via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 24 15:10:16 PDT 2024
================
@@ -3589,13 +3607,15 @@ void MachineBlockPlacement::applyExtTsp() {
CurrentBlockOrder.push_back(&MBB);
}
- auto BlockSizes = std::vector<uint64_t>(F->size());
- auto BlockCounts = std::vector<uint64_t>(F->size());
+ std::vector<uint64_t> BlockCounts(F->size());
+ std::vector<uint64_t> BlockSizes(F->size());
std::vector<codelayout::EdgeCount> JumpCounts;
+ SmallVector<MachineOperand, 4> Cond; // For analyzeBranch.
+ SmallVector<const MachineBasicBlock *, 4> Succs;
for (MachineBasicBlock &MBB : *F) {
// Getting the block frequency.
BlockFrequency BlockFreq = MBFI->getBlockFreq(&MBB);
- BlockCounts[BlockIndex[&MBB]] = BlockFreq.getFrequency();
+ BlockCounts[BlockIndex[&MBB]] = OptForSize ? 1 : BlockFreq.getFrequency();
----------------
ellishg wrote:
If `BlockFreq.getFrequency()` is zero, shouldn't it remain zero even if `OptForSize` is true?
Also, it seems `BlockCounts` is only used in `calcExtTspScore()`, and it's actually unused there. We should probably refactor `calcExtTspScore()` in another PR.
https://github.com/llvm/llvm-project/pull/109711
More information about the llvm-commits
mailing list