Problem using a label to a MachineBasicBlock

Hi all,

I think that I came somewhat closer to a solution for splitting a
MachineBasicBlock for a PSEUDO_CALL_R instruction and having a label to the new MBB:

For following piece of code:

Using 'NEW_BB->setIsLandingPad(true);' seems to resolve everything.


Jeroen Dobbelaere

Can you please post the code to split a MachineBasicBlock?

I am trying to split a MachineBasicBlock at a specific instruction in the
MBB, let us say, into MBB1 and MBB2. This instruction should go into MBB2.
Also MBB1 should have an unconditional branch to MBB2 as the terminator.
(quite similar to splitBasicBlock in BasicBlock.cpp)

Meanwhile, I am trying to come up with a variant of SplitCriticalEdge to do
this but if someone can provide the code to split a MBB, it will be of great

Jeroen Dobbelaere-2 wrote:

Hi Abhishek,

A good example for splitting basic blocks is in 'MBlazeTargetLowering::EmitCustomSelect' in

In your case, you will not create the 'flsBB' basic block, but only the 'dneBB'.
The 'splice' function is doing the actual split of the basic block.

btw. In my final solution for my original problem, I stopped splitting the basic block, but I inserted
a 'GC_LABEL' at the correct place. (This type of label is treated in the way that I needed,
although I did not need it for garbage collection).


Jeroen Dobbelaere