diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2022-03-20 11:40:34 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2022-06-04 11:58:51 +0000 |
| commit | 4b6eb0e63c698094db5506763df44cc83c19f643 (patch) | |
| tree | f1d30b8c10bc6db323b91538745ae8ab8b593910 /contrib/llvm-project/llvm/lib/CodeGen/MachineStripDebug.cpp | |
| parent | 76886853f03395abb680824bcc74e98f83bd477a (diff) | |
Diffstat (limited to 'contrib/llvm-project/llvm/lib/CodeGen/MachineStripDebug.cpp')
| -rw-r--r-- | contrib/llvm-project/llvm/lib/CodeGen/MachineStripDebug.cpp | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/contrib/llvm-project/llvm/lib/CodeGen/MachineStripDebug.cpp b/contrib/llvm-project/llvm/lib/CodeGen/MachineStripDebug.cpp index a1cb12f91275..86cf4999d4b0 100644 --- a/contrib/llvm-project/llvm/lib/CodeGen/MachineStripDebug.cpp +++ b/contrib/llvm-project/llvm/lib/CodeGen/MachineStripDebug.cpp @@ -50,29 +50,26 @@ struct StripDebugMachineModule : public ModulePass { continue; MachineFunction &MF = *MaybeMF; for (MachineBasicBlock &MBB : MF) { - for (MachineBasicBlock::iterator I = MBB.begin(), E = MBB.end(); - I != E;) { - if (I->isDebugInstr()) { + for (MachineInstr &MI : llvm::make_early_inc_range(MBB)) { + if (MI.isDebugInstr()) { // FIXME: We should remove all of them. However, AArch64 emits an // invalid `DBG_VALUE $lr` with only one operand instead of // the usual three and has a test that depends on it's // preservation. Preserve it for now. - if (I->getNumOperands() > 1) { - LLVM_DEBUG(dbgs() << "Removing debug instruction " << *I); - I = MBB.erase(I); + if (MI.getNumOperands() > 1) { + LLVM_DEBUG(dbgs() << "Removing debug instruction " << MI); + MBB.erase(&MI); Changed |= true; continue; } } - if (I->getDebugLoc()) { - LLVM_DEBUG(dbgs() << "Removing location " << *I); - I->setDebugLoc(DebugLoc()); + if (MI.getDebugLoc()) { + LLVM_DEBUG(dbgs() << "Removing location " << MI); + MI.setDebugLoc(DebugLoc()); Changed |= true; - ++I; continue; } - LLVM_DEBUG(dbgs() << "Keeping " << *I); - ++I; + LLVM_DEBUG(dbgs() << "Keeping " << MI); } } } |
