From e72ad2cd524ff38f162a23d69da5f78494d337ae Mon Sep 17 00:00:00 2001 From: Richard-Qin-X Date: Fri, 28 Aug 2026 13:45:07 +0800 Subject: [CodeGen] Centralize machine instruction erasure --- backend/lib/CodeGen/GlobalISel/InstructionSelect.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'backend/lib/CodeGen/GlobalISel/InstructionSelect.cpp') diff --git a/backend/lib/CodeGen/GlobalISel/InstructionSelect.cpp b/backend/lib/CodeGen/GlobalISel/InstructionSelect.cpp index 88bc78e..0814641 100644 --- a/backend/lib/CodeGen/GlobalISel/InstructionSelect.cpp +++ b/backend/lib/CodeGen/GlobalISel/InstructionSelect.cpp @@ -215,10 +215,9 @@ Expected InstructionSelect::run(MachineFunction &Function, return runImplementation(Function, Target, Analyses); } -Expected InstructionSelect::runImplementation(MachineFunction &Function, - const TargetDescription &Target, - MachineFunctionAnalysisManager - &Analyses) { +Expected +InstructionSelect::runImplementation(MachineFunction &Function, const TargetDescription &Target, + MachineFunctionAnalysisManager &Analyses) { MachinePassResult Result; std::vector Worklist; @@ -378,7 +377,7 @@ Expected InstructionSelect::runImplementation(MachineFunction auto Replaced = Function.registerInfo().replaceRegWith(*Destination, *Source); if (!Replaced) return std::unexpected(Replaced.error()); - auto Removed = Block->removeInstruction(*Instruction); + auto Removed = Instruction->eraseFromParent(); if (!Removed) return std::unexpected(Removed.error()); Result.Changed = true; -- cgit v1.2.3