Skip to content

Commit fd71201

Browse files
jayfoadmahesh-attarde
authored andcommitted
[MachineStripDebug] Remove debug instructions from inside bundles (llvm#160297)
Some passes, like AMDGPU's SIInsertHardClauses, wrap sequences of instructions into bundles, and these bundles may end up with debug instructions in the middle. Assuming that this is allowed, this patch fixes MachineStripDebug to be able to remove these instructions from inside a bundle.
1 parent 06b8808 commit fd71201

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

llvm/lib/CodeGen/MachineStripDebug.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ struct StripDebugMachineModule : public ModulePass {
5858
// preservation. Preserve it for now.
5959
if (MI.getNumOperands() > 1) {
6060
LLVM_DEBUG(dbgs() << "Removing debug instruction " << MI);
61-
MBB.erase(&MI);
61+
MBB.erase_instr(&MI);
6262
Changed |= true;
6363
continue;
6464
}

llvm/test/CodeGen/AMDGPU/hard-clauses.mir

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# RUN: llc -mtriple=amdgcn -mcpu=gfx1010 -verify-machineinstrs -run-pass si-insert-hard-clauses %s -o - | FileCheck %s
33
# RUN: llc -mtriple=amdgcn -mcpu=gfx1100 -verify-machineinstrs -run-pass si-insert-hard-clauses %s -o - | FileCheck %s -check-prefix=GFX11
44
# RUN: llc -mtriple=amdgcn -mcpu=gfx1200 -verify-machineinstrs -run-pass si-insert-hard-clauses %s -o - | FileCheck %s -check-prefix=GFX12
5+
# RUN: llc -mtriple=amdgcn -mcpu=gfx1200 -verify-machineinstrs -run-pass si-insert-hard-clauses %s -o - -debugify-and-strip-all-safe | FileCheck %s -check-prefix=GFX12
56

67
---
78
name: nop1

0 commit comments

Comments
 (0)