[MachineStripDebug] Remove debug instructions from inside bundles (#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.
This commit is contained in:
Jay Foad 2025-09-25 09:40:54 +01:00 committed by GitHub
parent 1034bb57ae
commit ed30414b0a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 1 deletions

View File

@ -58,7 +58,7 @@ struct StripDebugMachineModule : public ModulePass {
// preservation. Preserve it for now.
if (MI.getNumOperands() > 1) {
LLVM_DEBUG(dbgs() << "Removing debug instruction " << MI);
MBB.erase(&MI);
MBB.erase_instr(&MI);
Changed |= true;
continue;
}

View File

@ -2,6 +2,7 @@
# RUN: llc -mtriple=amdgcn -mcpu=gfx1010 -verify-machineinstrs -run-pass si-insert-hard-clauses %s -o - | FileCheck %s
# RUN: llc -mtriple=amdgcn -mcpu=gfx1100 -verify-machineinstrs -run-pass si-insert-hard-clauses %s -o - | FileCheck %s -check-prefix=GFX11
# RUN: llc -mtriple=amdgcn -mcpu=gfx1200 -verify-machineinstrs -run-pass si-insert-hard-clauses %s -o - | FileCheck %s -check-prefix=GFX12
# 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
---
name: nop1