[llvm] [CodeLayout] Size-aware machine block placement (PR #109711)

Ellis Hoag via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 26 10:01:33 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:

I created https://github.com/llvm/llvm-project/pull/110145 to remove `BlockCounts` from `calcExtTspScore()`.

https://github.com/llvm/llvm-project/pull/109711


More information about the llvm-commits mailing list