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

Amir Ayupov via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 13 15:03:01 PDT 2024


================
@@ -342,6 +345,15 @@ createFlowFunction(const BinaryFunction::BasicBlockOrderType &BlockOrder) {
       InDegree[Jump.Target]++;
       UniqueSuccs.insert(DstBB);
     }
+
+    // If the block is an exit, add a dummy edge from it to the sink block.
+    if (UniqueSuccs.empty()) {
+      Func.Jumps.emplace_back();
+      FlowJump &Jump = Func.Jumps.back();
+      Jump.Source = SrcBB->getIndex() + 1;
+      Jump.Target = Func.Blocks.size() - 1;
----------------
aaupov wrote:

Do we not need InDegree?

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


More information about the llvm-commits mailing list