From dd62896bc8ec45bf23e46be9bddcdfacd7856f9e Mon Sep 17 00:00:00 2001 From: "Mayeul@Zama" Date: Wed, 2 Nov 2022 12:13:39 +0100 Subject: [PATCH] chore(compiler): fix pessimizing-move --- compiler/CMakeLists.txt | 5 ++--- .../include/concretelang/Support/LambdaSupport.h | 16 ++++++++-------- compiler/lib/CAPI/Support/CompilerEngine.cpp | 7 +++---- 3 files changed, 13 insertions(+), 15 deletions(-) diff --git a/compiler/CMakeLists.txt b/compiler/CMakeLists.txt index f8d55070c..1375c4265 100644 --- a/compiler/CMakeLists.txt +++ b/compiler/CMakeLists.txt @@ -9,10 +9,9 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON) # Wouldn't be able to compile LLVM without this on Mac (using either Clang or AppleClang) if(APPLE) - add_definitions("-Wno-narrowing -Wno-dollar-in-identifier-extension -Wno-string-conversion -Wno-pessimizing-move") + add_definitions("-Wno-narrowing -Wno-dollar-in-identifier-extension -Wno-string-conversion") else() - add_definitions("-Wall -Wno-pessimizing-move") - add_definitions("-Werror ") + add_definitions("-Wall -Werror") endif() # If we are trying to build the compiler with LLVM/MLIR as libraries diff --git a/compiler/include/concretelang/Support/LambdaSupport.h b/compiler/include/concretelang/Support/LambdaSupport.h index 505fd839a..8e4ff894c 100644 --- a/compiler/include/concretelang/Support/LambdaSupport.h +++ b/compiler/include/concretelang/Support/LambdaSupport.h @@ -50,42 +50,42 @@ inline llvm::Expected typedScalarResult(clientlib::KeySet &keySet, template <> inline llvm::Expected typedResult(clientlib::KeySet &keySet, clientlib::PublicResult &result) { - return std::move(typedScalarResult(keySet, result)); + return typedScalarResult(keySet, result); } template <> inline llvm::Expected typedResult(clientlib::KeySet &keySet, clientlib::PublicResult &result) { - return std::move(typedScalarResult(keySet, result)); + return typedScalarResult(keySet, result); } template <> inline llvm::Expected typedResult(clientlib::KeySet &keySet, clientlib::PublicResult &result) { - return std::move(typedScalarResult(keySet, result)); + return typedScalarResult(keySet, result); } template <> inline llvm::Expected typedResult(clientlib::KeySet &keySet, clientlib::PublicResult &result) { - return std::move(typedScalarResult(keySet, result)); + return typedScalarResult(keySet, result); } template <> inline llvm::Expected typedResult(clientlib::KeySet &keySet, clientlib::PublicResult &result) { - return std::move(typedScalarResult(keySet, result)); + return typedScalarResult(keySet, result); } template <> inline llvm::Expected typedResult(clientlib::KeySet &keySet, clientlib::PublicResult &result) { - return std::move(typedScalarResult(keySet, result)); + return typedScalarResult(keySet, result); } template <> inline llvm::Expected typedResult(clientlib::KeySet &keySet, clientlib::PublicResult &result) { - return std::move(typedScalarResult(keySet, result)); + return typedScalarResult(keySet, result); } template <> inline llvm::Expected typedResult(clientlib::KeySet &keySet, clientlib::PublicResult &result) { - return std::move(typedScalarResult(keySet, result)); + return typedScalarResult(keySet, result); } template diff --git a/compiler/lib/CAPI/Support/CompilerEngine.cpp b/compiler/lib/CAPI/Support/CompilerEngine.cpp index 0eae46168..253e7f874 100644 --- a/compiler/lib/CAPI/Support/CompilerEngine.cpp +++ b/compiler/lib/CAPI/Support/CompilerEngine.cpp @@ -165,7 +165,7 @@ decrypt_result(concretelang::clientlib::KeySet &keySet, std::unique_ptr>( keySet, publicResult)); lambdaArgument result_{std::move(*result)}; - return std::move(result_); + return result_; } MLIR_CAPI_EXPORTED std::unique_ptr @@ -270,8 +270,7 @@ std::string roundTrip(const char *module) { retOrErr = ce.compile( module, mlir::concretelang::CompilerEngine::Target::ROUND_TRIP); if (!retOrErr) { - os << "MLIR parsing failed: " - << llvm::toString(std::move(retOrErr.takeError())); + os << "MLIR parsing failed: " << llvm::toString(retOrErr.takeError()); throw std::runtime_error(os.str()); } @@ -320,7 +319,7 @@ std::vector lambdaArgumentGetTensorData(lambdaArgument &lambda_arg) { std::string backingString; llvm::raw_string_ostream os(backingString); os << "Couldn't get size of tensor: " - << llvm::toString(std::move(sizeOrErr.takeError())); + << llvm::toString(sizeOrErr.takeError()); throw std::runtime_error(os.str()); } std::vector data(arg->getValue(), arg->getValue() + *sizeOrErr);