[llvm] 313ad85 - [Coroutines] Fix warnings

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 3 08:36:13 PDT 2024


Author: Kazu Hirata
Date: 2024-10-03T08:36:01-07:00
New Revision: 313ad85dfa40a18f2edefd7ce2edc0528d5a554a

URL: https://github.com/llvm/llvm-project/commit/313ad85dfa40a18f2edefd7ce2edc0528d5a554a
DIFF: https://github.com/llvm/llvm-project/commit/313ad85dfa40a18f2edefd7ce2edc0528d5a554a.diff

LOG: [Coroutines] Fix warnings

This patch fixes:

  llvm/include/llvm/Transforms/Coroutines/CoroSplit.h:26:1: note: did
  you mean struct here?

  llvm/lib/Transforms/Coroutines/CoroSplit.cpp:2225:16: error: moving
  a local object in a return statement prevents copy elision
  [-Werror,-Wpessimizing-move]

  llvm/lib/Transforms/Coroutines/CoroSplit.cpp:2236:16: error: moving
  a local object in a return statement prevents copy elision
  [-Werror,-Wpessimizing-move]

Added: 
    

Modified: 
    llvm/include/llvm/Transforms/Coroutines/CoroSplit.h
    llvm/lib/Transforms/Coroutines/CoroSplit.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Transforms/Coroutines/CoroSplit.h b/llvm/include/llvm/Transforms/Coroutines/CoroSplit.h
index 74ee948a339e31..52b6c4918ada9b 100644
--- a/llvm/include/llvm/Transforms/Coroutines/CoroSplit.h
+++ b/llvm/include/llvm/Transforms/Coroutines/CoroSplit.h
@@ -23,7 +23,7 @@ namespace llvm {
 
 namespace coro {
 class BaseABI;
-class Shape;
+struct Shape;
 } // namespace coro
 
 struct CoroSplitPass : PassInfoMixin<CoroSplitPass> {

diff  --git a/llvm/lib/Transforms/Coroutines/CoroSplit.cpp b/llvm/lib/Transforms/Coroutines/CoroSplit.cpp
index 6fdead9a9c3501..4fbda077129fa5 100644
--- a/llvm/lib/Transforms/Coroutines/CoroSplit.cpp
+++ b/llvm/lib/Transforms/Coroutines/CoroSplit.cpp
@@ -2222,7 +2222,7 @@ CoroSplitPass::CoroSplitPass(bool OptimizeFrame)
         std::unique_ptr<coro::BaseABI> ABI =
             CreateNewABI(F, S, coro::isTriviallyMaterializable);
         ABI->init();
-        return std::move(ABI);
+        return ABI;
       }),
       OptimizeFrame(OptimizeFrame) {}
 
@@ -2233,7 +2233,7 @@ CoroSplitPass::CoroSplitPass(std::function<bool(Instruction &)> IsMatCallback,
     : CreateAndInitABI([=](Function &F, coro::Shape &S) {
         std::unique_ptr<coro::BaseABI> ABI = CreateNewABI(F, S, IsMatCallback);
         ABI->init();
-        return std::move(ABI);
+        return ABI;
       }),
       OptimizeFrame(OptimizeFrame) {}
 


        


More information about the llvm-commits mailing list