[llvm] [CodeLayout] Size-aware machine block placement (PR #109711)
Kyungwoo Lee via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 26 09:25:13 PDT 2024
================
@@ -3604,24 +3624,48 @@ void MachineBlockPlacement::applyExtTsp() {
// not see a perf improvement with the exact block sizes.
auto NonDbgInsts =
instructionsWithoutDebug(MBB.instr_begin(), MBB.instr_end());
- int NumInsts = std::distance(NonDbgInsts.begin(), NonDbgInsts.end());
+ size_t NumInsts = std::distance(NonDbgInsts.begin(), NonDbgInsts.end());
BlockSizes[BlockIndex[&MBB]] = 4 * NumInsts;
// Getting jump frequencies.
- for (MachineBasicBlock *Succ : MBB.successors()) {
- auto EP = MBPI->getEdgeProbability(&MBB, Succ);
- BlockFrequency JumpFreq = BlockFreq * EP;
- JumpCounts.push_back(
- {BlockIndex[&MBB], BlockIndex[Succ], JumpFreq.getFrequency()});
+
+ if (!OptForSize) {
----------------
kyulee-com wrote:
Could we swap the conditions in the if/else statement?
```suggestion
if (OptForSize) {
...
```
https://github.com/llvm/llvm-project/pull/109711
More information about the llvm-commits
mailing list