[llvm] r236316 - Remove std::move on return when it could prevent copy elision.

Benjamin Kramer benny.kra at googlemail.com
Fri May 1 08:16:12 PDT 2015


Author: d0k
Date: Fri May  1 10:16:11 2015
New Revision: 236316

URL: http://llvm.org/viewvc/llvm-project?rev=236316&view=rev
Log:
Remove std::move on return when it could prevent copy elision.

Found by -Wpessimizing-move, no functional change. The APFloat and
PassManager change doesn't affect codegen as returning a by-value
argument will always result in a move.

Modified:
    llvm/trunk/include/llvm/ADT/APFloat.h
    llvm/trunk/include/llvm/IR/PassManager.h
    llvm/trunk/utils/yaml-bench/YAMLBench.cpp

Modified: llvm/trunk/include/llvm/ADT/APFloat.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/APFloat.h?rev=236316&r1=236315&r2=236316&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/APFloat.h (original)
+++ llvm/trunk/include/llvm/ADT/APFloat.h Fri May  1 10:16:11 2015
@@ -343,7 +343,7 @@ public:
   /// copied from some other APFloat.
   static APFloat copySign(APFloat Value, const APFloat &Sign) {
     Value.copySign(Sign);
-    return std::move(Value);
+    return Value;
   }
 
   /// @}

Modified: llvm/trunk/include/llvm/IR/PassManager.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/PassManager.h?rev=236316&r1=236315&r2=236316&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/PassManager.h (original)
+++ llvm/trunk/include/llvm/IR/PassManager.h Fri May  1 10:16:11 2015
@@ -509,7 +509,7 @@ private:
   PreservedAnalyses invalidateImpl(IRUnitT &IR, PreservedAnalyses PA) {
     // Short circuit for a common case of all analyses being preserved.
     if (PA.areAllPreserved())
-      return std::move(PA);
+      return PA;
 
     if (DebugLogging)
       dbgs() << "Invalidating all non-preserved analyses for: "
@@ -549,7 +549,7 @@ private:
     if (ResultsList.empty())
       AnalysisResultLists.erase(&IR);
 
-    return std::move(PA);
+    return PA;
   }
 
   /// \brief List of function analysis pass IDs and associated concept pointers.

Modified: llvm/trunk/utils/yaml-bench/YAMLBench.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/yaml-bench/YAMLBench.cpp?rev=236316&r1=236315&r2=236316&view=diff
==============================================================================
--- llvm/trunk/utils/yaml-bench/YAMLBench.cpp (original)
+++ llvm/trunk/utils/yaml-bench/YAMLBench.cpp Fri May  1 10:16:11 2015
@@ -69,7 +69,7 @@ static std::string prettyTag(yaml::Node
   if (StringRef(Tag).startswith("tag:yaml.org,2002:")) {
     std::string Ret = "!!";
     Ret += StringRef(Tag).substr(18);
-    return std::move(Ret);
+    return Ret;
   }
   std::string Ret = "!<";
   Ret += Tag;





More information about the llvm-commits mailing list