[llvm] Revert "Remove redundant move in return statement" (PR #91169)

Mehdi Amini via llvm-commits llvm-commits at lists.llvm.org
Mon May 6 00:49:59 PDT 2024


https://github.com/joker-eph created https://github.com/llvm/llvm-project/pull/91169

Reverts llvm/llvm-project#90546

This broke some bots, seems like some toolchain don’t consider the implicit move here.

>From 037743895cde439e45ceba5ab171db252d3c8e62 Mon Sep 17 00:00:00 2001
From: Mehdi Amini <joker.eph at gmail.com>
Date: Mon, 6 May 2024 15:47:26 +0800
Subject: [PATCH] Revert "Remove redundant move in return statement (#90546)"

This reverts commit db532ff9584a2fe4b375188400986e0dd17ad92b.
---
 llvm/include/llvm/ExecutionEngine/Orc/IndirectionUtils.h | 2 +-
 llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h            | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/llvm/include/llvm/ExecutionEngine/Orc/IndirectionUtils.h b/llvm/include/llvm/ExecutionEngine/Orc/IndirectionUtils.h
index 6dd99a76cf2afb..f0263e0d78e75e 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/IndirectionUtils.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/IndirectionUtils.h
@@ -77,7 +77,7 @@ class TrampolinePool {
     std::lock_guard<std::mutex> Lock(TPMutex);
     if (AvailableTrampolines.empty()) {
       if (auto Err = grow())
-        return Err;
+        return std::move(Err);
     }
     assert(!AvailableTrampolines.empty() && "Failed to grow trampoline pool");
     auto TrampolineAddr = AvailableTrampolines.back();
diff --git a/llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h b/llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h
index 2608a95e40a36b..3a71ddc88ce956 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h
@@ -488,18 +488,18 @@ class LLJITBuilderSetters {
   /// Create an instance of the JIT.
   Expected<std::unique_ptr<JITType>> create() {
     if (auto Err = impl().prepareForConstruction())
-      return Err;
+      return std::move(Err);
 
     Error Err = Error::success();
     std::unique_ptr<JITType> J(new JITType(impl(), Err));
     if (Err)
-      return Err;
+      return std::move(Err);
 
     if (impl().NotifyCreated)
       if (Error Err = impl().NotifyCreated(*J))
-        return Err;
+        return std::move(Err);
 
-    return J;
+    return std::move(J);
   }
 
 protected:



More information about the llvm-commits mailing list