[llvm] r273047 - Apply another batch of fixes from clang-tidy's performance-unnecessary-value-param.

Benjamin Kramer via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 17 13:41:15 PDT 2016


Author: d0k
Date: Fri Jun 17 15:41:14 2016
New Revision: 273047

URL: http://llvm.org/viewvc/llvm-project?rev=273047&view=rev
Log:
Apply another batch of fixes from clang-tidy's performance-unnecessary-value-param.

Contains some manual fixes. No functionality change intended.

Modified:
    llvm/trunk/include/llvm/Bitcode/ReaderWriter.h
    llvm/trunk/include/llvm/CodeGen/DIE.h
    llvm/trunk/include/llvm/CodeGen/SelectionDAG.h
    llvm/trunk/include/llvm/ExecutionEngine/ExecutionEngine.h
    llvm/trunk/include/llvm/Object/ModuleSummaryIndexObjectFile.h
    llvm/trunk/include/llvm/Support/Printable.h
    llvm/trunk/include/llvm/Transforms/IPO/Internalize.h
    llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
    llvm/trunk/lib/CodeGen/AsmPrinter/DIEHash.cpp
    llvm/trunk/lib/CodeGen/AsmPrinter/DIEHash.h
    llvm/trunk/lib/CodeGen/ParallelCG.cpp
    llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
    llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldChecker.cpp
    llvm/trunk/lib/Object/ModuleSummaryIndexObjectFile.cpp
    llvm/trunk/lib/Transforms/IPO/FunctionImport.cpp
    llvm/trunk/lib/Transforms/Scalar/GVN.cpp
    llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp
    llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp
    llvm/trunk/tools/llvm-profdata/llvm-profdata.cpp
    llvm/trunk/tools/sancov/sancov.cc

Modified: llvm/trunk/include/llvm/Bitcode/ReaderWriter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Bitcode/ReaderWriter.h?rev=273047&r1=273046&r2=273047&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Bitcode/ReaderWriter.h (original)
+++ llvm/trunk/include/llvm/Bitcode/ReaderWriter.h Fri Jun 17 15:41:14 2016
@@ -71,13 +71,14 @@ namespace llvm {
                                                     LLVMContext &Context);
 
   /// Check if the given bitcode buffer contains a summary block.
-  bool hasGlobalValueSummary(MemoryBufferRef Buffer,
-                             DiagnosticHandlerFunction DiagnosticHandler);
+  bool
+  hasGlobalValueSummary(MemoryBufferRef Buffer,
+                        const DiagnosticHandlerFunction &DiagnosticHandler);
 
   /// Parse the specified bitcode buffer, returning the module summary index.
   ErrorOr<std::unique_ptr<ModuleSummaryIndex>>
   getModuleSummaryIndex(MemoryBufferRef Buffer,
-                        DiagnosticHandlerFunction DiagnosticHandler);
+                        const DiagnosticHandlerFunction &DiagnosticHandler);
 
   /// \brief Write the specified module to the specified raw output stream.
   ///

Modified: llvm/trunk/include/llvm/CodeGen/DIE.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/DIE.h?rev=273047&r1=273046&r2=273047&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/DIE.h (original)
+++ llvm/trunk/include/llvm/CodeGen/DIE.h Fri Jun 17 15:41:14 2016
@@ -565,7 +565,7 @@ public:
   typedef iterator_range<value_iterator> value_range;
   typedef iterator_range<const_value_iterator> const_value_range;
 
-  value_iterator addValue(BumpPtrAllocator &Alloc, DIEValue V) {
+  value_iterator addValue(BumpPtrAllocator &Alloc, const DIEValue &V) {
     List.push_back(*new (Alloc) Node(V));
     return value_iterator(ListTy::toIterator(List.back()));
   }

Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAG.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAG.h?rev=273047&r1=273046&r2=273047&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/SelectionDAG.h (original)
+++ llvm/trunk/include/llvm/CodeGen/SelectionDAG.h Fri Jun 17 15:41:14 2016
@@ -1382,7 +1382,7 @@ private:
                                void *&InsertPos);
   SDNode *FindModifiedNodeSlot(SDNode *N, ArrayRef<SDValue> Ops,
                                void *&InsertPos);
-  SDNode *UpdadeSDLocOnMergedSDNode(SDNode *N, SDLoc loc);
+  SDNode *UpdadeSDLocOnMergedSDNode(SDNode *N, const SDLoc &loc);
 
   void DeleteNodeNotInCSEMaps(SDNode *N);
   void DeallocateNode(SDNode *N);

Modified: llvm/trunk/include/llvm/ExecutionEngine/ExecutionEngine.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/ExecutionEngine.h?rev=273047&r1=273046&r2=273047&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ExecutionEngine/ExecutionEngine.h (original)
+++ llvm/trunk/include/llvm/ExecutionEngine/ExecutionEngine.h Fri Jun 17 15:41:14 2016
@@ -478,11 +478,11 @@ public:
   /// specified function pointer is invoked to create it.  If it returns null,
   /// the JIT will abort.
   void InstallLazyFunctionCreator(FunctionCreator C) {
-    LazyFunctionCreator = C;
+    LazyFunctionCreator = std::move(C);
   }
 
 protected:
-  ExecutionEngine(const DataLayout DL) : DL(std::move(DL)){}
+  ExecutionEngine(DataLayout DL) : DL(std::move(DL)) {}
   explicit ExecutionEngine(DataLayout DL, std::unique_ptr<Module> M);
   explicit ExecutionEngine(std::unique_ptr<Module> M);
 

Modified: llvm/trunk/include/llvm/Object/ModuleSummaryIndexObjectFile.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/ModuleSummaryIndexObjectFile.h?rev=273047&r1=273046&r2=273047&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Object/ModuleSummaryIndexObjectFile.h (original)
+++ llvm/trunk/include/llvm/Object/ModuleSummaryIndexObjectFile.h Fri Jun 17 15:41:14 2016
@@ -81,23 +81,23 @@ public:
 
   /// \brief Looks for summary sections in the given memory buffer,
   /// returns true if found, else false.
-  static bool
-  hasGlobalValueSummaryInMemBuffer(MemoryBufferRef Object,
-                                   DiagnosticHandlerFunction DiagnosticHandler);
+  static bool hasGlobalValueSummaryInMemBuffer(
+      MemoryBufferRef Object,
+      const DiagnosticHandlerFunction &DiagnosticHandler);
 
   /// \brief Parse module summary index in the given memory buffer.
   /// Return new ModuleSummaryIndexObjectFile instance containing parsed module
   /// summary/index.
   static ErrorOr<std::unique_ptr<ModuleSummaryIndexObjectFile>>
-  create(MemoryBufferRef Object, DiagnosticHandlerFunction DiagnosticHandler);
+  create(MemoryBufferRef Object,
+         const DiagnosticHandlerFunction &DiagnosticHandler);
 };
 }
 
 /// Parse the module summary index out of an IR file and return the module
 /// summary index object if found, or nullptr if not.
-ErrorOr<std::unique_ptr<ModuleSummaryIndex>>
-getModuleSummaryIndexForFile(StringRef Path,
-                             DiagnosticHandlerFunction DiagnosticHandler);
+ErrorOr<std::unique_ptr<ModuleSummaryIndex>> getModuleSummaryIndexForFile(
+    StringRef Path, const DiagnosticHandlerFunction &DiagnosticHandler);
 }
 
 #endif

Modified: llvm/trunk/include/llvm/Support/Printable.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Printable.h?rev=273047&r1=273046&r2=273047&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/Printable.h (original)
+++ llvm/trunk/include/llvm/Support/Printable.h Fri Jun 17 15:41:14 2016
@@ -38,7 +38,7 @@ class raw_ostream;
 class Printable {
 public:
   std::function<void(raw_ostream &OS)> Print;
-  Printable(const std::function<void(raw_ostream &OS)> Print)
+  Printable(std::function<void(raw_ostream &OS)> Print)
       : Print(std::move(Print)) {}
 };
 

Modified: llvm/trunk/include/llvm/Transforms/IPO/Internalize.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/IPO/Internalize.h?rev=273047&r1=273046&r2=273047&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Transforms/IPO/Internalize.h (original)
+++ llvm/trunk/include/llvm/Transforms/IPO/Internalize.h Fri Jun 17 15:41:14 2016
@@ -53,8 +53,7 @@ class InternalizePass : public PassInfoM
 
 public:
   InternalizePass();
-  InternalizePass(
-      const std::function<bool(const GlobalValue &)> MustPreserveGV)
+  InternalizePass(std::function<bool(const GlobalValue &)> MustPreserveGV)
       : MustPreserveGV(std::move(MustPreserveGV)) {}
 
   /// Run the internalizer on \p TheModule, returns true if any changes was
@@ -68,10 +67,10 @@ public:
 };
 
 /// Helper function to internalize functions and variables in a Module.
-inline bool internalizeModule(
-    Module &TheModule,
-    const std::function<bool(const GlobalValue &)> MustPreserveGV,
-    CallGraph *CG = nullptr) {
+inline bool
+internalizeModule(Module &TheModule,
+                  std::function<bool(const GlobalValue &)> MustPreserveGV,
+                  CallGraph *CG = nullptr) {
   return InternalizePass(std::move(MustPreserveGV))
       .internalizeModule(TheModule, CG);
 }

Modified: llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp?rev=273047&r1=273046&r2=273047&view=diff
==============================================================================
--- llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp (original)
+++ llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp Fri Jun 17 15:41:14 2016
@@ -552,14 +552,14 @@ BitcodeDiagnosticInfo::BitcodeDiagnostic
 
 void BitcodeDiagnosticInfo::print(DiagnosticPrinter &DP) const { DP << Msg; }
 
-static std::error_code error(DiagnosticHandlerFunction DiagnosticHandler,
+static std::error_code error(const DiagnosticHandlerFunction &DiagnosticHandler,
                              std::error_code EC, const Twine &Message) {
   BitcodeDiagnosticInfo DI(EC, DS_Error, Message);
   DiagnosticHandler(DI);
   return EC;
 }
 
-static std::error_code error(DiagnosticHandlerFunction DiagnosticHandler,
+static std::error_code error(const DiagnosticHandlerFunction &DiagnosticHandler,
                              std::error_code EC) {
   return error(DiagnosticHandler, EC, EC.message());
 }
@@ -6555,9 +6555,9 @@ std::string llvm::getBitcodeProducerStri
 }
 
 // Parse the specified bitcode buffer, returning the function info index.
-ErrorOr<std::unique_ptr<ModuleSummaryIndex>>
-llvm::getModuleSummaryIndex(MemoryBufferRef Buffer,
-                            DiagnosticHandlerFunction DiagnosticHandler) {
+ErrorOr<std::unique_ptr<ModuleSummaryIndex>> llvm::getModuleSummaryIndex(
+    MemoryBufferRef Buffer,
+    const DiagnosticHandlerFunction &DiagnosticHandler) {
   std::unique_ptr<MemoryBuffer> Buf = MemoryBuffer::getMemBuffer(Buffer, false);
   ModuleSummaryIndexBitcodeReader R(Buf.get(), DiagnosticHandler);
 
@@ -6576,8 +6576,9 @@ llvm::getModuleSummaryIndex(MemoryBuffer
 }
 
 // Check if the given bitcode buffer contains a global value summary block.
-bool llvm::hasGlobalValueSummary(MemoryBufferRef Buffer,
-                                 DiagnosticHandlerFunction DiagnosticHandler) {
+bool llvm::hasGlobalValueSummary(
+    MemoryBufferRef Buffer,
+    const DiagnosticHandlerFunction &DiagnosticHandler) {
   std::unique_ptr<MemoryBuffer> Buf = MemoryBuffer::getMemBuffer(Buffer, false);
   ModuleSummaryIndexBitcodeReader R(Buf.get(), DiagnosticHandler, true);
 

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DIEHash.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DIEHash.cpp?rev=273047&r1=273046&r2=273047&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DIEHash.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DIEHash.cpp Fri Jun 17 15:41:14 2016
@@ -279,7 +279,7 @@ void DIEHash::hashLocList(const DIELocLi
 
 // Hash an individual attribute \param Attr based on the type of attribute and
 // the form.
-void DIEHash::hashAttribute(DIEValue Value, dwarf::Tag Tag) {
+void DIEHash::hashAttribute(const DIEValue &Value, dwarf::Tag Tag) {
   dwarf::Attribute Attribute = Value.getAttribute();
 
   // Other attribute values use the letter 'A' as the marker, and the value

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DIEHash.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DIEHash.h?rev=273047&r1=273046&r2=273047&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DIEHash.h (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DIEHash.h Fri Jun 17 15:41:14 2016
@@ -131,7 +131,7 @@ private:
   void hashLocList(const DIELocList &LocList);
 
   /// \brief Hashes an individual attribute.
-  void hashAttribute(DIEValue Value, dwarf::Tag Tag);
+  void hashAttribute(const DIEValue &Value, dwarf::Tag Tag);
 
   /// \brief Hashes an attribute that refers to another DIE.
   void hashDIEEntry(dwarf::Attribute Attribute, dwarf::Tag Tag,

Modified: llvm/trunk/lib/CodeGen/ParallelCG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/ParallelCG.cpp?rev=273047&r1=273046&r2=273047&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/ParallelCG.cpp (original)
+++ llvm/trunk/lib/CodeGen/ParallelCG.cpp Fri Jun 17 15:41:14 2016
@@ -25,10 +25,9 @@
 
 using namespace llvm;
 
-static void
-codegen(Module *M, llvm::raw_pwrite_stream &OS,
-        std::function<std::unique_ptr<TargetMachine>()> TMFactory,
-        TargetMachine::CodeGenFileType FileType) {
+static void codegen(Module *M, llvm::raw_pwrite_stream &OS,
+                    function_ref<std::unique_ptr<TargetMachine>()> TMFactory,
+                    TargetMachine::CodeGenFileType FileType) {
   std::unique_ptr<TargetMachine> TM = TMFactory();
   legacy::PassManager CodeGenPasses;
   if (TM->addPassesToEmitFile(CodeGenPasses, OS, FileType))

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=273047&r1=273046&r2=273047&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Fri Jun 17 15:41:14 2016
@@ -5977,7 +5977,7 @@ SDNode *SelectionDAG::SelectNodeTo(SDNod
 /// probability having other instructions associated with that line.
 ///
 /// For IROrder, we keep the smaller of the two
-SDNode *SelectionDAG::UpdadeSDLocOnMergedSDNode(SDNode *N, SDLoc OLoc) {
+SDNode *SelectionDAG::UpdadeSDLocOnMergedSDNode(SDNode *N, const SDLoc &OLoc) {
   DebugLoc NLoc = N->getDebugLoc();
   if (NLoc && OptLevel == CodeGenOpt::None && OLoc.getDebugLoc() != NLoc) {
     N->setDebugLoc(DebugLoc());

Modified: llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldChecker.cpp?rev=273047&r1=273046&r2=273047&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldChecker.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldChecker.cpp Fri Jun 17 15:41:14 2016
@@ -584,7 +584,7 @@ private:
   // Returns a pair containing the result of the slice operation, plus the
   // expression remaining to be parsed.
   std::pair<EvalResult, StringRef>
-  evalSliceExpr(std::pair<EvalResult, StringRef> Ctx) const {
+  evalSliceExpr(const std::pair<EvalResult, StringRef> &Ctx) const {
     EvalResult SubExprResult;
     StringRef RemainingExpr;
     std::tie(SubExprResult, RemainingExpr) = Ctx;
@@ -628,7 +628,7 @@ private:
   // Returns a pair containing the ultimate result of evaluating the
   // expression, plus the expression remaining to be evaluated.
   std::pair<EvalResult, StringRef>
-  evalComplexExpr(std::pair<EvalResult, StringRef> LHSAndRemaining,
+  evalComplexExpr(const std::pair<EvalResult, StringRef> &LHSAndRemaining,
                   ParseContext PCtx) const {
     EvalResult LHSResult;
     StringRef RemainingExpr;

Modified: llvm/trunk/lib/Object/ModuleSummaryIndexObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/ModuleSummaryIndexObjectFile.cpp?rev=273047&r1=273046&r2=273047&view=diff
==============================================================================
--- llvm/trunk/lib/Object/ModuleSummaryIndexObjectFile.cpp (original)
+++ llvm/trunk/lib/Object/ModuleSummaryIndexObjectFile.cpp Fri Jun 17 15:41:14 2016
@@ -70,7 +70,8 @@ ModuleSummaryIndexObjectFile::findBitcod
 // Looks for module summary index in the given memory buffer.
 // returns true if found, else false.
 bool ModuleSummaryIndexObjectFile::hasGlobalValueSummaryInMemBuffer(
-    MemoryBufferRef Object, DiagnosticHandlerFunction DiagnosticHandler) {
+    MemoryBufferRef Object,
+    const DiagnosticHandlerFunction &DiagnosticHandler) {
   ErrorOr<MemoryBufferRef> BCOrErr = findBitcodeInMemBuffer(Object);
   if (!BCOrErr)
     return false;
@@ -83,7 +84,8 @@ bool ModuleSummaryIndexObjectFile::hasGl
 // module summary/index.
 ErrorOr<std::unique_ptr<ModuleSummaryIndexObjectFile>>
 ModuleSummaryIndexObjectFile::create(
-    MemoryBufferRef Object, DiagnosticHandlerFunction DiagnosticHandler) {
+    MemoryBufferRef Object,
+    const DiagnosticHandlerFunction &DiagnosticHandler) {
   std::unique_ptr<ModuleSummaryIndex> Index;
 
   ErrorOr<MemoryBufferRef> BCOrErr = findBitcodeInMemBuffer(Object);
@@ -105,7 +107,7 @@ ModuleSummaryIndexObjectFile::create(
 // Parse the module summary index out of an IR file and return the summary
 // index object if found, or nullptr if not.
 ErrorOr<std::unique_ptr<ModuleSummaryIndex>> llvm::getModuleSummaryIndexForFile(
-    StringRef Path, DiagnosticHandlerFunction DiagnosticHandler) {
+    StringRef Path, const DiagnosticHandlerFunction &DiagnosticHandler) {
   ErrorOr<std::unique_ptr<MemoryBuffer>> FileOrErr =
       MemoryBuffer::getFileOrSTDIN(Path);
   std::error_code EC = FileOrErr.getError();

Modified: llvm/trunk/lib/Transforms/IPO/FunctionImport.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/FunctionImport.cpp?rev=273047&r1=273046&r2=273047&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/FunctionImport.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/FunctionImport.cpp Fri Jun 17 15:41:14 2016
@@ -679,9 +679,9 @@ static void diagnosticHandler(const Diag
 
 /// Parse the summary index out of an IR file and return the summary
 /// index object if found, or nullptr if not.
-static std::unique_ptr<ModuleSummaryIndex>
-getModuleSummaryIndexForFile(StringRef Path, std::string &Error,
-                             DiagnosticHandlerFunction DiagnosticHandler) {
+static std::unique_ptr<ModuleSummaryIndex> getModuleSummaryIndexForFile(
+    StringRef Path, std::string &Error,
+    const DiagnosticHandlerFunction &DiagnosticHandler) {
   std::unique_ptr<MemoryBuffer> Buffer;
   ErrorOr<std::unique_ptr<MemoryBuffer>> BufferOrErr =
       MemoryBuffer::getFile(Path);

Modified: llvm/trunk/lib/Transforms/Scalar/GVN.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/GVN.cpp?rev=273047&r1=273046&r2=273047&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/GVN.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/GVN.cpp Fri Jun 17 15:41:14 2016
@@ -106,7 +106,7 @@ template <> struct DenseMapInfo<GVN::Exp
 
   static inline GVN::Expression getTombstoneKey() { return ~1U; }
 
-  static unsigned getHashValue(const GVN::Expression e) {
+  static unsigned getHashValue(const GVN::Expression &e) {
     using llvm::hash_value;
     return static_cast<unsigned>(hash_value(e));
   }

Modified: llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp?rev=273047&r1=273046&r2=273047&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp Fri Jun 17 15:41:14 2016
@@ -1399,9 +1399,9 @@ bool MemCpyOptPass::runImpl(
   bool MadeChange = false;
   MD = MD_;
   TLI = TLI_;
-  LookupAliasAnalysis = LookupAliasAnalysis_;
-  LookupAssumptionCache = LookupAssumptionCache_;
-  LookupDomTree = LookupDomTree_;
+  LookupAliasAnalysis = std::move(LookupAliasAnalysis_);
+  LookupAssumptionCache = std::move(LookupAssumptionCache_);
+  LookupDomTree = std::move(LookupDomTree_);
 
   // If we don't have at least memset and memcpy, there is little point of doing
   // anything here.  These are required by a freestanding implementation, so if

Modified: llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp?rev=273047&r1=273046&r2=273047&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp (original)
+++ llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp Fri Jun 17 15:41:14 2016
@@ -325,8 +325,8 @@ public:
   // can be validly truncated to. The cost model has assumed this truncation
   // will happen when vectorizing.
   void vectorize(LoopVectorizationLegality *L,
-                 MapVector<Instruction *, uint64_t> MinimumBitWidths) {
-    MinBWs = MinimumBitWidths;
+                 const MapVector<Instruction *, uint64_t> &MinimumBitWidths) {
+    MinBWs = &MinimumBitWidths;
     Legal = L;
     // Create a new empty loop. Unlink the old loop and connect the new one.
     createEmptyLoop();
@@ -597,7 +597,7 @@ protected:
   /// Map of scalar integer values to the smallest bitwidth they can be legally
   /// represented as. The vector equivalents of these values should be truncated
   /// to this type.
-  MapVector<Instruction *, uint64_t> MinBWs;
+  const MapVector<Instruction *, uint64_t> *MinBWs;
   LoopVectorizationLegality *Legal;
 
   // Record whether runtime checks are added.
@@ -1431,7 +1431,7 @@ private:
   /// Updates the vectorization state by adding \p Phi to the inductions list.
   /// This can set \p Phi as the main induction of the loop if \p Phi is a
   /// better choice for the main induction than the existing one.
-  void addInductionPhi(PHINode *Phi, InductionDescriptor ID,
+  void addInductionPhi(PHINode *Phi, const InductionDescriptor &ID,
                        SmallPtrSetImpl<Value *> &AllowedExit);
 
   /// Report an analysis message to assist the user in diagnosing loops that are
@@ -3494,7 +3494,7 @@ void InnerLoopVectorizer::truncateToMini
   // later and will remove any ext/trunc pairs.
   //
   SmallPtrSet<Value *, 4> Erased;
-  for (auto &KV : MinBWs) {
+  for (const auto &KV : *MinBWs) {
     VectorParts &Parts = WidenMap.get(KV.first);
     for (Value *&I : Parts) {
       if (Erased.count(I) || I->use_empty())
@@ -3589,7 +3589,7 @@ void InnerLoopVectorizer::truncateToMini
   }
 
   // We'll have created a bunch of ZExts that are now parentless. Clean up.
-  for (auto &KV : MinBWs) {
+  for (const auto &KV : *MinBWs) {
     VectorParts &Parts = WidenMap.get(KV.first);
     for (Value *&I : Parts) {
       ZExtInst *Inst = dyn_cast<ZExtInst>(I);
@@ -4724,7 +4724,7 @@ static bool hasOutsideLoopUser(const Loo
 }
 
 void LoopVectorizationLegality::addInductionPhi(
-    PHINode *Phi, InductionDescriptor ID,
+    PHINode *Phi, const InductionDescriptor &ID,
     SmallPtrSetImpl<Value *> &AllowedExit) {
   Inductions[Phi] = ID;
   Type *PhiTy = Phi->getType();

Modified: llvm/trunk/tools/llvm-profdata/llvm-profdata.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-profdata/llvm-profdata.cpp?rev=273047&r1=273046&r2=273047&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-profdata/llvm-profdata.cpp (original)
+++ llvm/trunk/tools/llvm-profdata/llvm-profdata.cpp Fri Jun 17 15:41:14 2016
@@ -321,18 +321,19 @@ static int merge_main(int argc, const ch
   return 0;
 }
 
-static int showInstrProfile(std::string Filename, bool ShowCounts,
+static int showInstrProfile(const std::string &Filename, bool ShowCounts,
                             bool ShowIndirectCallTargets,
                             bool ShowDetailedSummary,
                             std::vector<uint32_t> DetailedSummaryCutoffs,
-                            bool ShowAllFunctions, std::string ShowFunction,
-                            bool TextFormat, raw_fd_ostream &OS) {
+                            bool ShowAllFunctions,
+                            const std::string &ShowFunction, bool TextFormat,
+                            raw_fd_ostream &OS) {
   auto ReaderOrErr = InstrProfReader::create(Filename);
-  std::vector<uint32_t> Cutoffs(DetailedSummaryCutoffs);
-  if (ShowDetailedSummary && DetailedSummaryCutoffs.empty()) {
+  std::vector<uint32_t> Cutoffs = std::move(DetailedSummaryCutoffs);
+  if (ShowDetailedSummary && Cutoffs.empty()) {
     Cutoffs = {800000, 900000, 950000, 990000, 999000, 999900, 999990};
   }
-  InstrProfSummaryBuilder Builder(Cutoffs);
+  InstrProfSummaryBuilder Builder(std::move(Cutoffs));
   if (Error E = ReaderOrErr.takeError())
     exitWithError(std::move(E), Filename);
 
@@ -438,8 +439,9 @@ static int showInstrProfile(std::string
   return 0;
 }
 
-static int showSampleProfile(std::string Filename, bool ShowCounts,
-                             bool ShowAllFunctions, std::string ShowFunction,
+static int showSampleProfile(const std::string &Filename, bool ShowCounts,
+                             bool ShowAllFunctions,
+                             const std::string &ShowFunction,
                              raw_fd_ostream &OS) {
   using namespace sampleprof;
   LLVMContext Context;

Modified: llvm/trunk/tools/sancov/sancov.cc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/sancov/sancov.cc?rev=273047&r1=273046&r2=273047&view=diff
==============================================================================
--- llvm/trunk/tools/sancov/sancov.cc (original)
+++ llvm/trunk/tools/sancov/sancov.cc Fri Jun 17 15:41:14 2016
@@ -234,7 +234,7 @@ struct AddrInfo : public DILineInfo {
   }
 
 private:
-  static std::string normalizeFilename(std::string FileName) {
+  static std::string normalizeFilename(const std::string &FileName) {
     SmallString<256> S(FileName);
     sys::path::remove_dots(S, /* remove_dot_dot */ true);
     return S.str().str();
@@ -284,7 +284,7 @@ private:
 };
 
 // Collect all debug info for given addresses.
-static std::vector<AddrInfo> getAddrInfo(std::string ObjectFile,
+static std::vector<AddrInfo> getAddrInfo(const std::string &ObjectFile,
                                          const std::set<uint64_t> &Addrs,
                                          bool InlinedCode) {
   std::vector<AddrInfo> Result;
@@ -416,7 +416,7 @@ static void getObjectCoveragePoints(cons
 
 static void
 visitObjectFiles(const object::Archive &A,
-                 std::function<void(const object::ObjectFile &)> Fn) {
+                 function_ref<void(const object::ObjectFile &)> Fn) {
   for (auto &ErrorOrChild : A.children()) {
     FailIfError(ErrorOrChild);
     const object::Archive::Child &C = *ErrorOrChild;
@@ -430,8 +430,8 @@ visitObjectFiles(const object::Archive &
 }
 
 static void
-visitObjectFiles(std::string FileName,
-                 std::function<void(const object::ObjectFile &)> Fn) {
+visitObjectFiles(const std::string &FileName,
+                 function_ref<void(const object::ObjectFile &)> Fn) {
   Expected<object::OwningBinary<object::Binary>> BinaryOrErr =
       object::createBinary(FileName);
   if (!BinaryOrErr)
@@ -446,7 +446,7 @@ visitObjectFiles(std::string FileName,
     FailIfError(object::object_error::invalid_file_type);
 }
 
-std::set<uint64_t> findSanitizerCovFunctions(std::string FileName) {
+std::set<uint64_t> findSanitizerCovFunctions(const std::string &FileName) {
   std::set<uint64_t> Result;
   visitObjectFiles(FileName, [&](const object::ObjectFile &O) {
     auto Addrs = findSanitizerCovFunctions(O);
@@ -458,7 +458,7 @@ std::set<uint64_t> findSanitizerCovFunct
 // Locate addresses of all coverage points in a file. Coverage point
 // is defined as the 'address of instruction following __sanitizer_cov
 // call - 1'.
-std::set<uint64_t> getCoveragePoints(std::string FileName) {
+std::set<uint64_t> getCoveragePoints(const std::string &FileName) {
   std::set<uint64_t> Result;
   visitObjectFiles(FileName, [&](const object::ObjectFile &O) {
     getObjectCoveragePoints(O, &Result);
@@ -466,7 +466,7 @@ std::set<uint64_t> getCoveragePoints(std
   return Result;
 }
 
-static void printCovPoints(std::string ObjFile, raw_ostream &OS) {
+static void printCovPoints(const std::string &ObjFile, raw_ostream &OS) {
   for (uint64_t Addr : getCoveragePoints(ObjFile)) {
     OS << "0x";
     OS.write_hex(Addr);
@@ -515,7 +515,7 @@ static std::string formatHtmlPct(size_t
   return Zeroes + Num;
 }
 
-static std::string anchorName(std::string Anchor) {
+static std::string anchorName(const std::string &Anchor) {
   llvm::MD5 Hasher;
   llvm::MD5::MD5Result Hash;
   Hasher.update(Anchor);
@@ -526,7 +526,7 @@ static std::string anchorName(std::strin
   return HexString.str().str();
 }
 
-static ErrorOr<bool> isCoverageFile(std::string FileName) {
+static ErrorOr<bool> isCoverageFile(const std::string &FileName) {
   ErrorOr<std::unique_ptr<MemoryBuffer>> BufOrErr =
       MemoryBuffer::getFile(FileName);
   if (!BufOrErr) {
@@ -564,7 +564,8 @@ static raw_ostream &operator<<(raw_ostre
 class CoverageData {
 public:
   // Read single file coverage data.
-  static ErrorOr<std::unique_ptr<CoverageData>> read(std::string FileName) {
+  static ErrorOr<std::unique_ptr<CoverageData>>
+  read(const std::string &FileName) {
     ErrorOr<std::unique_ptr<MemoryBuffer>> BufOrErr =
         MemoryBuffer::getFile(FileName);
     if (!BufOrErr)
@@ -847,7 +848,7 @@ static void printFunctionLocs(const Sour
 class CoverageDataWithObjectFile : public CoverageData {
 public:
   static ErrorOr<std::unique_ptr<CoverageDataWithObjectFile>>
-  readAndMerge(std::string ObjectFile,
+  readAndMerge(const std::string &ObjectFile,
                const std::vector<std::string> &FileNames) {
     auto MergedDataOrError = CoverageData::readAndMerge(FileNames);
     if (!MergedDataOrError)




More information about the llvm-commits mailing list