Basic Block Label Not Emitted

Hello All,

I am currently working on an llvm pass to instrument x86 assembly code.
I was able to write a MachineFunction pass to create and insert Machine Instructions.
My issue is that I create a Machine Basic Block via : MachineBasicBlock * MBB = MF.CreateMachineBasicBlock(BB);
Then I set the label as must be emitted via : MBB->setLabelMustBeEmitted();
The block is indeed created and added to the function but the problem is it doesn’t have a label !!

Does anyone have an idea why does that happen? or what is it that I am doing wrong?

Thank you in advance.

Do you insert it into the function correctly, or are you currently just creating a dead MBB?

I actually add it to the end of the function. I can visualize the added instruction in my assembly code but the block doesn’t have a label (only a comment)