[llvm] [BOLT][NFC] Add sink block to flow CFG in profile inference (PR #95047)

Maksim Panchenko via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 10 22:35:00 PDT 2024


================
@@ -372,6 +377,17 @@ createFlowFunction(const BinaryFunction::BasicBlockOrderType &BlockOrder) {
     }
   }
 
+  // Add dummy edges from the exit blocks to the sink block.
+  for (uint64_t I = 1; I < BlockOrder.size() + 1; I++) {
+    FlowBlock &Block = Func.Blocks[I];
+    if (Block.IsExit) {
----------------
maksfb wrote:

Nit: use "early continue" (https://llvm.org/docs/CodingStandards.html#use-early-exits-and-continue-to-simplify-code). Since `Block` is not used anywhere else, I'd just write:
```
  if (!Func.Blocks[I].IsExit)
    continue;

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


More information about the llvm-commits mailing list