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