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/MachineBranchOptimization.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/MachineBranchOptimization.cpp')
| -rw-r--r-- | backend/lib/CodeGen/MachineBranchOptimization.cpp | 19 |
1 files changed, 1 insertions, 18 deletions
diff --git a/backend/lib/CodeGen/MachineBranchOptimization.cpp b/backend/lib/CodeGen/MachineBranchOptimization.cpp index e03b0d9..6e3bc17 100644 --- a/backend/lib/CodeGen/MachineBranchOptimization.cpp +++ b/backend/lib/CodeGen/MachineBranchOptimization.cpp @@ -8,7 +8,6 @@ #include "rcc/CodeGen/MachineBasicBlockAttributes.h" #include "rcc/CodeGen/MachineCFGUpdater.h" #include "rcc/CodeGen/MachineFunction.h" -#include "rcc/CodeGen/MachineFunctionCloner.h" #include "rcc/CodeGen/MachineFunctionRecords.h" #include "rcc/CodeGen/MachineInstr.h" #include "rcc/CodeGen/MachineJumpTableInfo.h" @@ -21,7 +20,6 @@ #include <algorithm> #include <cstddef> #include <cstdint> -#include <optional> #include <ranges> #include <string> #include <unordered_set> @@ -581,22 +579,7 @@ const MachinePassContract &MachineBranchOptimizationPass::contract() const noexc Expected<MachinePassResult> MachineBranchOptimizationPass::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(), "branch optimization 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(), "branch optimization diverged after a successful transaction preflight: ")); - } - return Result; + return runImplementation(Function, Target); } Expected<MachinePassResult> |
