Closed
Description
New branch instruction replaces the old terminator in the same block, without the debug location propagation.
// Create a new unconditional branch that will continue the loop as a new
// terminator.
BranchInst::Create(ContinueBB, ParentBB);
New branch instruction replaces the old terminator in the same block, without the debug location propagation.
// Remove the cloned branch instruction.
ParentBB->getTerminator()->eraseFromParent();
// Create unconditional branch now.
BranchInst::Create(ContinueBB, ParentBB);
New switch instruction replaces the old terminator in the same block, without the debug location propagation.
// Split the preheader, so that we know that there is a safe place to insert
// the switch.
BasicBlock *OldPH = L.getLoopPreheader();
BasicBlock *NewPH = SplitEdge(OldPH, L.getHeader(), &DT, &LI, MSSAU);
OldPH->getTerminator()->eraseFromParent();
// Now add the unswitched switch.
->auto *NewSI = SwitchInst::Create(LoopCond, NewPH, ExitCases.size(), OldPH);
New branch instruction replaces the old terminator in the same block, without the debug location propagation.
// Now nuke the switch and replace it with a direct branch.
SIW.eraseFromParent();
BranchInst::Create(CommonSuccBB, BB);