Skip to content

[DebugInfo][SimpleLoopUnswitch] Missing debug location updates for the new terminators (Part 2) #98787

Closed
@Apochens

Description

@Apochens

SimpleLoopUnswitch-L635

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);

SimpleLoopUnswitch-L672

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);

SimpleLoopUnswitch-L865

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);

SimpleLoopUnswitch-L976

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);

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions