aboutsummaryrefslogtreecommitdiff
path: root/backend/lib/CodeGen/MachineBranchOptimization.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'backend/lib/CodeGen/MachineBranchOptimization.cpp')
-rw-r--r--backend/lib/CodeGen/MachineBranchOptimization.cpp9
1 files changed, 2 insertions, 7 deletions
diff --git a/backend/lib/CodeGen/MachineBranchOptimization.cpp b/backend/lib/CodeGen/MachineBranchOptimization.cpp
index c102931..d09de97 100644
--- a/backend/lib/CodeGen/MachineBranchOptimization.cpp
+++ b/backend/lib/CodeGen/MachineBranchOptimization.cpp
@@ -45,11 +45,6 @@ namespace {
return Contract;
}
-[[nodiscard]] Error prefixedError(const Error &Failure, std::string Prefix) {
- Prefix.append(Failure.message());
- return Error(Failure.code(), std::move(Prefix));
-}
-
[[nodiscard]] bool hasProtectedAttachment(const MachineInstr &Instruction) noexcept {
return Instruction.debugInstrNumber() != 0 || Instruction.preInstrSymbol().has_value() ||
Instruction.postInstrSymbol().has_value() || Instruction.heapAllocMarker().has_value() ||
@@ -311,14 +306,14 @@ Expected<MachinePassResult> MachineBranchOptimizationPass::run(MachineFunction &
MachineFunctionCloneOptions{.NewStableID = Function.stableID(), .NewName = std::nullopt});
if (!Trial) {
return std::unexpected(
- prefixedError(Trial.error(), "branch optimization transaction setup failed: "));
+ 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(prefixedError(
+ return std::unexpected(withErrorContext(
Result.error(), "branch optimization diverged after a successful transaction preflight: "));
}
return Result;