Inserting a new MachineBasicBlock between two existing MachineBasicBlocks

To insert block B after block A,

MachineFunction::iterator MBBI = A;

MF.insert(MBBI, B)

Thanks, nick. I think I found my problem,

LIS->insertMBBInMaps(B) already takes care of adding the block into slotIndexes so I don’t have to call
LIS->getSlotIndexes()->insertMBBInMaps(B) again.

Now I’m trying to figure out how to correctly update the LiveIntervals …

Can someone briefly introduce what MachineBasicBlock::SplitCriticalEdge() function does, it looks very like what I’m trying to do …