Remove std::move on return when it could prevent copy elision.
authorBenjamin Kramer <benny.kra@googlemail.com>
Fri, 1 May 2015 15:16:11 +0000 (15:16 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Fri, 1 May 2015 15:16:11 +0000 (15:16 +0000)
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236316 91177308-0d34-0410-b5e6-96231b3b80d8

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

index 53b53c5dfa546df940a2a003028b23c3db68e4dd..958e3fdaea14dc69255db32a4ba2cfa8d5f16f8c 100644 (file)
@@ -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;
   }
 
   /// @}
index 3c24e7231a15fccd25fc7542437154713aecc2a3..b566f01ca8bbb18b4a2e50cbc48d9e416783663b 100644 (file)
@@ -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.
index 872f586ef7e1896235d21bab3603ec2b17d346ec..0fb31387fc2e7a01b9d2262ef8f77de8050f0667 100644 (file)
@@ -69,7 +69,7 @@ static std::string prettyTag(yaml::Node *N) {
   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;