diff options
| author | Richard-Qin-X <richard.qin.001@gmail.com> | 2026-08-27 15:53:10 +0800 |
|---|---|---|
| committer | Richard-Qin-X <richard.qin.001@gmail.com> | 2026-08-27 15:53:10 +0800 |
| commit | b7cb5381e520a25e8f0f465903d8eea1972761c2 (patch) | |
| tree | db2c30c677ed8eec20f0f4e37d6387fa05cc6a6b /backend/lib/CodeGen/MachineCSE.cpp | |
| parent | a932de71457e16030d7d05e4230c56e231c7a8e9 (diff) | |
| download | rcc-project-b7cb5381e520a25e8f0f465903d8eea1972761c2.tar.gz rcc-project-b7cb5381e520a25e8f0f465903d8eea1972761c2.tar.xz | |
[CodeGen] Run machine optimizations once
Diffstat (limited to 'backend/lib/CodeGen/MachineCSE.cpp')
| -rw-r--r-- | backend/lib/CodeGen/MachineCSE.cpp | 21 |
1 files changed, 1 insertions, 20 deletions
diff --git a/backend/lib/CodeGen/MachineCSE.cpp b/backend/lib/CodeGen/MachineCSE.cpp index 50dca0e..7bd5a22 100644 --- a/backend/lib/CodeGen/MachineCSE.cpp +++ b/backend/lib/CodeGen/MachineCSE.cpp @@ -7,7 +7,6 @@ #include "rcc/CodeGen/MachineAnalyses.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" @@ -16,7 +15,6 @@ #include <cstddef> #include <cstdint> -#include <optional> #include <string> #include <unordered_map> #include <unordered_set> @@ -293,24 +291,7 @@ const MachinePassContract &MachineCSEPass::contract() const noexcept { Expected<MachinePassResult> MachineCSEPass::run(MachineFunction &Function, const TargetDescription &Target, MachineFunctionAnalysisManager &Analyses) { - auto Trial = cloneMachineFunction( - Function, Target, - MachineFunctionCloneOptions{.NewStableID = Function.stableID(), .NewName = std::nullopt}); - if (!Trial) { - return std::unexpected( - withErrorContext(Trial.error(), "machine CSE transaction setup failed: ")); - } - MachineFunctionAnalysisManager TrialAnalyses; - auto TrialResult = runImplementation(*Trial->ClonedFunction, Target, TrialAnalyses); - if (!TrialResult) - return std::unexpected(TrialResult.error()); - - auto Result = runImplementation(Function, Target, Analyses); - if (!Result) { - return std::unexpected(withErrorContext( - Result.error(), "machine CSE diverged after a successful transaction preflight: ")); - } - return Result; + return runImplementation(Function, Target, Analyses); } Expected<MachinePassResult> |
