Hi all,
Suppose I have two basicblock A->B, and I wanted to insert C between them so that A->B->C.
By looking at MachineBasicBlock::SplitCriticalEdge, I did following similar steps:
MachineBasicBlock *B = MF.CreateMachineBasicBlock();
MF.insert(std::next(MachineFunction::iterator(A)), B);
LIS->insertMBBInMaps(B);
LIS->getSlotIndexes()->insertMBBInMaps(B);
But when I try to add the new basicblock into SlotIndexes, it fails at the assertion.
assert(unsigned(mbb->getNumber()) == MBBRanges.size() && “Blocks must be added in order”);
So I thought maybe I should add it at the end of the function, so I tried
MF.insert(MF.end(), B), but it still fails, so I’m wondering what’s the right way to do it.
I’m doing it at MachineScheduler Pass.
Thanks in Advance
Patrick