[llvm] [CodeLayout] Size-aware machine block placement (PR #109711)
via llvm-commits
llvm-commits at lists.llvm.org
Sat Sep 28 15:17:23 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();
----------------
spupyrev wrote:
> If BlockFreq.getFrequency() is zero, shouldn't it remain zero even if OptForSize is true?
IIRC we don't have blocks with zero-frequency; it is always positive, but might be very small for never-executed blocks.
https://github.com/llvm/llvm-project/pull/109711
More information about the llvm-commits
mailing list