From b7cb5381e520a25e8f0f465903d8eea1972761c2 Mon Sep 17 00:00:00 2001 From: Richard-Qin-X Date: Thu, 27 Aug 2026 15:53:10 +0800 Subject: [CodeGen] Run machine optimizations once --- backend/lib/CodeGen/MachineMemoryFolding.cpp | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) (limited to 'backend/lib/CodeGen/MachineMemoryFolding.cpp') diff --git a/backend/lib/CodeGen/MachineMemoryFolding.cpp b/backend/lib/CodeGen/MachineMemoryFolding.cpp index 388f72c..fb4b86d 100644 --- a/backend/lib/CodeGen/MachineMemoryFolding.cpp +++ b/backend/lib/CodeGen/MachineMemoryFolding.cpp @@ -5,7 +5,6 @@ #include "rcc/CodeGen/InstructionDescriptor.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" @@ -181,22 +180,7 @@ const MachinePassContract &MachineMemoryFoldingPass::contract() const noexcept { Expected MachineMemoryFoldingPass::run(MachineFunction &Function, const TargetDescription &Target, MachineFunctionAnalysisManager &) { - auto Trial = cloneMachineFunction( - Function, Target, - MachineFunctionCloneOptions{.NewStableID = Function.stableID(), .NewName = std::nullopt}); - if (!Trial) { - return std::unexpected( - withErrorContext(Trial.error(), "memory folding transaction setup failed: ")); - } - auto TrialResult = runImplementation(*Trial->ClonedFunction, Target); - if (!TrialResult) - return std::unexpected(TrialResult.error()); - auto Result = runImplementation(Function, Target); - if (!Result) { - return std::unexpected(withErrorContext( - Result.error(), "memory folding diverged after a successful transaction preflight: ")); - } - return Result; + return runImplementation(Function, Target); } Expected -- cgit v1.2.3