Successors of MBB

Hello All,

In my implementation of EmitInstrWithCustomInserter I have two branches in machine basic block so this MBB has 3 successors (two from branches and one fallthrough) but I’ve not found such a solution in other targets. I wonder if there is any restriction for the number of successors for MBB?

There is no restriction. For example, indirect branches can have multiple (more than two) targets.

Worth mentioning is perhaps that machine optimizations such as BranchFolding and IfConversion probably only handle simple cases with one or two successors (possibly depending on your analyzeBranch implementation for your backend). See https://llvm.org/docs/WritingAnLLVMBackend.html#branch-folding-and-if-conversion

So while there is no restriction to the number of successors, there might be implications when it comes to the amount of optimizations done if you have more than two successors.

/Björn