[PATCH] D70597: [PHIEliminate] skip dbg instruction when LowerPHINode

Chris Ye via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 17 00:25:04 PST 2020


yechunliang added a comment.

My proposed code is as below: moving debug instrs after LastPHIIt at the beginning of PHIElimination

  void spliceDebugInstructionForward(MachineBasicBlock &MBB,
      MachineBasicBlock::iterator From,
      MachineBasicBlock::iterator To)
  {
    if (From == To)
      return;
  
    MachineBasicBlock::iterator insertBefore = std::next(To);
  
    for (MachineBasicBlock::iterator Inst = std::prev(To); Inst != From; --Inst) {
      if(Inst->isDebugInstr()) {
        MBB.splice(insertBefore, &MBB, Inst);
        Inst = std::prev(Inst);
      }
    }
  }

  if (LastPHIIt->isLabel())
    spliceDebugInstructionForward(MBB, MBB.begin(), LastPHIIt);

  


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70597/new/

https://reviews.llvm.org/D70597





More information about the llvm-commits mailing list