From 5fd19fbe147eaff6e65e7dc3b63b324d80f19a05 Mon Sep 17 00:00:00 2001 From: Richard-Qin-X Date: Thu, 27 Aug 2026 16:05:37 +0800 Subject: [CodeGen] Remove machine action replay --- backend/lib/Target/RISCV/RISCVOptWInstrs.cpp | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) (limited to 'backend/lib/Target/RISCV/RISCVOptWInstrs.cpp') diff --git a/backend/lib/Target/RISCV/RISCVOptWInstrs.cpp b/backend/lib/Target/RISCV/RISCVOptWInstrs.cpp index ea989d4..124a4f0 100644 --- a/backend/lib/Target/RISCV/RISCVOptWInstrs.cpp +++ b/backend/lib/Target/RISCV/RISCVOptWInstrs.cpp @@ -4,7 +4,6 @@ #include "rcc/CodeGen/GenericOpcodes.h" #include "rcc/CodeGen/MachineBasicBlock.h" #include "rcc/CodeGen/MachineFunction.h" -#include "rcc/CodeGen/MachineFunctionCloner.h" #include "rcc/CodeGen/MachineInstr.h" #include "rcc/CodeGen/MachineMemOperand.h" #include "rcc/CodeGen/MachineOperand.h" @@ -593,20 +592,9 @@ public: "RISC-V W-instruction optimization requires a subtarget"); const bool PreferWordInstructions = Subtarget->features().has(RISCVSubtargetOption::PreferWordInstructions); - auto Trial = cloneMachineFunction( - Function, Target, - MachineFunctionCloneOptions{.NewStableID = Function.stableID(), .NewName = std::nullopt}); - if (!Trial) - return std::unexpected(Trial.error()); - auto TrialResult = runImplementation(*Trial->ClonedFunction, Target, PreferWordInstructions); - if (!TrialResult) - return std::unexpected(TrialResult.error()); auto Changed = runImplementation(Function, Target, PreferWordInstructions); - if (!Changed) { - return std::unexpected(withErrorContext( - Changed.error(), - "RISC-V W-instruction optimization diverged after transaction preflight: ")); - } + if (!Changed) + return std::unexpected(Changed.error()); MachinePassResult Result; Result.Changed = *Changed; -- cgit v1.2.3