]> granicus.if.org Git - llvm/commitdiff
Apply clang-tidy's performance-unnecessary-value-param to LLVM.
authorBenjamin Kramer <benny.kra@googlemail.com>
Fri, 13 Jan 2017 14:39:03 +0000 (14:39 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Fri, 13 Jan 2017 14:39:03 +0000 (14:39 +0000)
With some minor manual fixes for using function_ref instead of
std::function. No functional change intended.

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

34 files changed:
include/llvm/CodeGen/GlobalISel/LegalizerInfo.h
include/llvm/CodeGen/MIRYamlMapping.h
include/llvm/CodeGen/RegAllocPBQP.h
include/llvm/CodeGen/SelectionDAG.h
include/llvm/DebugInfo/CodeView/SymbolRecord.h
include/llvm/DebugInfo/CodeView/TypeDatabase.h
include/llvm/IR/IRBuilder.h
include/llvm/LTO/Caching.h
include/llvm/MC/MCParser/MCAsmParser.h
include/llvm/MC/MCParser/MCAsmParserExtension.h
include/llvm/Target/TargetMachine.h
lib/Analysis/CFLAndersAliasAnalysis.cpp
lib/Bitcode/Reader/MetadataLoader.cpp
lib/CodeGen/GlobalISel/MachineIRBuilder.cpp
lib/CodeGen/LLVMTargetMachine.cpp
lib/CodeGen/SelectionDAG/DAGCombiner.cpp
lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h
lib/DebugInfo/CodeView/TypeDatabase.cpp
lib/LTO/Caching.cpp
lib/MC/MCParser/MCAsmParser.cpp
lib/Target/AArch64/AArch64CallLowering.cpp
lib/Target/AArch64/AArch64CallLowering.h
lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.cpp
lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.h
lib/Target/AMDGPU/SIISelLowering.cpp
lib/Target/ARM/ARMCallLowering.cpp
lib/Target/ARM/ARMISelLowering.cpp
lib/Target/X86/X86ISelLowering.cpp
lib/Transforms/IPO/InlineSimple.cpp
lib/Transforms/IPO/PartialInlining.cpp
lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp
lib/Transforms/Scalar/ConstantHoisting.cpp
lib/Transforms/Scalar/RewriteStatepointsForGC.cpp

index edf52daf3f8fec7768f31ca6c6bb9cf5409eab3d..4a9e535090ce6ad77f0eeb897928a6a1ee86ac5e 100644 (file)
@@ -144,7 +144,7 @@ public:
   /// Iterate the given function (typically something like doubling the width)
   /// on Ty until we find a legal type for this operation.
   LLT findLegalType(const InstrAspect &Aspect,
-                    std::function<LLT(LLT)> NextType) const {
+                    function_ref<LLT(LLT)> NextType) const {
     LegalizeAction Action;
     const TypeMap &Map = Actions[Aspect.Opcode - FirstOp][Aspect.Idx];
     LLT Ty = Aspect.Type;
index 778f72c06e651d88200889652056e5a9d3f23c6a..05d0429ab63a13549a8bfbe7e8993d0df1ba057e 100644 (file)
@@ -55,7 +55,7 @@ template <> struct ScalarTraits<StringValue> {
 
 struct FlowStringValue : StringValue {
   FlowStringValue() {}
-  FlowStringValue(std::string Value) : StringValue(Value) {}
+  FlowStringValue(std::string Value) : StringValue(std::move(Value)) {}
 };
 
 template <> struct ScalarTraits<FlowStringValue> {
index 2cad90bbb7039fbb0f9fa756897e737c1494946b..d458bd95f68067aa243f85d97e09a909dad2fa43 100644 (file)
@@ -496,7 +496,7 @@ class PBQPRAGraph : public PBQP::Graph<RegAllocSolverImpl> {
 private:
   typedef PBQP::Graph<RegAllocSolverImpl> BaseT;
 public:
-  PBQPRAGraph(GraphMetadata Metadata) : BaseT(Metadata) {}
+  PBQPRAGraph(GraphMetadata Metadata) : BaseT(std::move(Metadata)) {}
 
   /// @brief Dump this graph to dbgs().
   void dump() const;
index 54d0436e4ab835b78b6d261d06229fff92d1b1ff..5a291c79c9363266db8089cc428a658899920351 100644 (file)
@@ -239,7 +239,7 @@ public:
     std::function<void(SDNode *, SDNode *)> Callback;
     DAGNodeDeletedListener(SelectionDAG &DAG,
                            std::function<void(SDNode *, SDNode *)> Callback)
-        : DAGUpdateListener(DAG), Callback(Callback) {}
+        : DAGUpdateListener(DAG), Callback(std::move(Callback)) {}
     void NodeDeleted(SDNode *N, SDNode *E) override { Callback(N, E); }
   };
 
index 57772d39e972b898f5b3b56981cdf798f1948cb1..2c3648ad28a9caaa96e4a4de45f9f51d526a6fa3 100644 (file)
@@ -176,7 +176,7 @@ struct BinaryAnnotationIterator {
     return Data == Other.Data;
   }
 
-  bool operator!=(BinaryAnnotationIterator Other) const {
+  bool operator!=(const BinaryAnnotationIterator &Other) const {
     return !(*this == Other);
   }
 
index cccc2868ffb5feb0aaa938fd9c9578de7ee5efb8..c00d3b79420156183689b9127d580ffb7815e247 100644 (file)
@@ -27,7 +27,7 @@ public:
   TypeIndex getNextTypeIndex() const;
 
   /// Records the name of a type, and reserves its type index.
-  void recordType(StringRef Name, CVType Data);
+  void recordType(StringRef Name, const CVType &Data);
 
   /// Saves the name in a StringSet and creates a stable StringRef.
   StringRef saveTypeName(StringRef TypeName);
index 1d9c16989de9bc3e8f34faa60b7d6c09a823e875..5a41b5a2ed631b97e32c365817cb6684505f58ff 100644 (file)
@@ -75,7 +75,7 @@ class IRBuilderCallbackInserter : IRBuilderDefaultInserter {
 
 public:
   IRBuilderCallbackInserter(std::function<void(Instruction *)> Callback)
-      : Callback(Callback) {}
+      : Callback(std::move(Callback)) {}
 
 protected:
   void InsertHelper(Instruction *I, const Twine &Name,
index 3b96bd1dc301f96105eb59bc893dea06138d9137..769f4cd9cc769ed976861bb0af6102c97e16ac21 100644 (file)
@@ -29,7 +29,7 @@ typedef std::function<void(unsigned Task, StringRef Path)> AddFileFn;
 
 /// Create a local file system cache which uses the given cache directory and
 /// file callback.
-NativeObjectCache localCache(std::string CacheDirectoryPath, AddFileFn AddFile);
+NativeObjectCache localCache(StringRef CacheDirectoryPath, AddFileFn AddFile);
 
 } // namespace lto
 } // namespace llvm
index eb85a3a3096377fe205e7e31dcdbd790349c127f..c289f51f43f75007823d36f8cdb06c24e5b08000 100644 (file)
@@ -186,7 +186,7 @@ public:
 
   bool parseEOL(const Twine &ErrMsg);
 
-  bool parseMany(std::function<bool()> parseOne, bool hasComma = true);
+  bool parseMany(function_ref<bool()> parseOne, bool hasComma = true);
 
   bool parseIntToken(int64_t &V, const Twine &ErrMsg);
 
index dabda0ab9485a348492cac6ed1a5b988817c1f7c..7817d41c0170270b6b8e129d1103b14cf0d30f23 100644 (file)
@@ -85,7 +85,7 @@ public:
     return getParser().parseToken(T, Msg);
   }
 
-  bool parseMany(std::function<bool()> parseOne, bool hasComma = true) {
+  bool parseMany(function_ref<bool()> parseOne, bool hasComma = true) {
     return getParser().parseMany(parseOne, hasComma);
   }
 
index b1d8f8f1e91730a5464c059591cf4253e914af42..013e58ee415bfa8455ccc03353b48f4c816fcdfb 100644 (file)
@@ -268,8 +268,8 @@ class LLVMTargetMachine : public TargetMachine {
 protected: // Can only create subclasses.
   LLVMTargetMachine(const Target &T, StringRef DataLayoutString,
                     const Triple &TargetTriple, StringRef CPU, StringRef FS,
-                    TargetOptions Options, Reloc::Model RM, CodeModel::Model CM,
-                    CodeGenOpt::Level OL);
+                    const TargetOptions &Options, Reloc::Model RM,
+                    CodeModel::Model CM, CodeGenOpt::Level OL);
 
   void initAsmInfo();
 public:
index e48ff230f43cb17754506eaa092f8c23a03c4b38..ddd5123d0eff72a138cd938fc251e69e1a41e259 100644 (file)
@@ -307,7 +307,7 @@ class CFLAndersAAResult::FunctionInfo {
 
 public:
   FunctionInfo(const Function &, const SmallVectorImpl<Value *> &,
-               const ReachabilitySet &, AliasAttrMap);
+               const ReachabilitySet &, const AliasAttrMap &);
 
   bool mayAlias(const Value *, uint64_t, const Value *, uint64_t) const;
   const AliasSummary &getAliasSummary() const { return Summary; }
@@ -470,7 +470,7 @@ static void populateExternalAttributes(
 
 CFLAndersAAResult::FunctionInfo::FunctionInfo(
     const Function &Fn, const SmallVectorImpl<Value *> &RetVals,
-    const ReachabilitySet &ReachSet, AliasAttrMap AMap) {
+    const ReachabilitySet &ReachSet, const AliasAttrMap &AMap) {
   populateAttrMap(AttrMap, AMap);
   populateExternalAttributes(Summary.RetParamAttributes, Fn, RetVals, AMap);
   populateAliasMap(AliasMap, ReachSet);
index 4a5d18e2db75097c97bff1e121502e7711ba08b3..47019c50ba061efb5a9b7c084f7a382f87469d70 100644 (file)
@@ -456,7 +456,7 @@ class MetadataLoader::MetadataLoaderImpl {
                          PlaceholderQueue &Placeholders, StringRef Blob,
                          unsigned &NextMetadataNo);
   Error parseMetadataStrings(ArrayRef<uint64_t> Record, StringRef Blob,
-                             std::function<void(StringRef)> CallBack);
+                             function_ref<void(StringRef)> CallBack);
   Error parseGlobalObjectAttachment(GlobalObject &GO,
                                     ArrayRef<uint64_t> Record);
   Error parseMetadataKindRecord(SmallVectorImpl<uint64_t> &Record);
@@ -480,7 +480,7 @@ public:
                      bool IsImporting)
       : MetadataList(TheModule.getContext()), ValueList(ValueList),
         Stream(Stream), Context(TheModule.getContext()), TheModule(TheModule),
-        getTypeByID(getTypeByID), IsImporting(IsImporting) {}
+        getTypeByID(std::move(getTypeByID)), IsImporting(IsImporting) {}
 
   Error parseMetadata(bool ModuleLevel);
 
@@ -1506,7 +1506,7 @@ Error MetadataLoader::MetadataLoaderImpl::parseOneMetadata(
 
 Error MetadataLoader::MetadataLoaderImpl::parseMetadataStrings(
     ArrayRef<uint64_t> Record, StringRef Blob,
-    std::function<void(StringRef)> CallBack) {
+    function_ref<void(StringRef)> CallBack) {
   // All the MDStrings in the block are emitted together in a single
   // record.  The strings are concatenated and stored in a blob along with
   // their sizes.
@@ -1703,8 +1703,8 @@ MetadataLoader::MetadataLoader(BitstreamCursor &Stream, Module &TheModule,
                                BitcodeReaderValueList &ValueList,
                                bool IsImporting,
                                std::function<Type *(unsigned)> getTypeByID)
-    : Pimpl(llvm::make_unique<MetadataLoaderImpl>(Stream, TheModule, ValueList,
-                                                  getTypeByID, IsImporting)) {}
+    : Pimpl(llvm::make_unique<MetadataLoaderImpl>(
+          Stream, TheModule, ValueList, std::move(getTypeByID), IsImporting)) {}
 
 Error MetadataLoader::parseMetadata(bool ModuleLevel) {
   return Pimpl->parseMetadata(ModuleLevel);
index c04f6e4ae897a52313844818424d7f6afa1e9bd3..70a992d3693f6b0676741de7a7efaddb94ede7b4 100644 (file)
@@ -54,7 +54,7 @@ void MachineIRBuilder::setInsertPt(MachineBasicBlock &MBB,
 
 void MachineIRBuilder::recordInsertions(
     std::function<void(MachineInstr *)> Inserted) {
-  InsertedInstr = Inserted;
+  InsertedInstr = std::move(Inserted);
 }
 
 void MachineIRBuilder::stopRecordingInsertions() {
index 26794e28020eb0f32b5c50267e71a927fb1738e1..cb79d3acdecc3a871925f34d4974acebe70e5830 100644 (file)
@@ -85,7 +85,7 @@ void LLVMTargetMachine::initAsmInfo() {
 LLVMTargetMachine::LLVMTargetMachine(const Target &T,
                                      StringRef DataLayoutString,
                                      const Triple &TT, StringRef CPU,
-                                     StringRef FS, TargetOptions Options,
+                                     StringRef FS, const TargetOptions &Options,
                                      Reloc::Model RM, CodeModel::Model CM,
                                      CodeGenOpt::Level OL)
     : TargetMachine(T, DataLayoutString, TT, CPU, FS, Options) {
index 680f62fa91bc66a6bde8061b15de47ade0886d5d..fb64fa3667f88e455683019b56196b21e49f0a79 100644 (file)
@@ -384,9 +384,9 @@ namespace {
     SDValue reduceBuildVecExtToExtBuildVec(SDNode *N);
     SDValue reduceBuildVecConvertToConvertBuildVec(SDNode *N);
     SDValue reduceBuildVecToShuffle(SDNode *N);
-    SDValue createBuildVecShuffle(SDLoc DL, SDNode *N, ArrayRef<int> VectorMask,
-                                  SDValue VecIn1, SDValue VecIn2,
-                                  unsigned LeftIdx);
+    SDValue createBuildVecShuffle(const SDLoc &DL, SDNode *N,
+                                  ArrayRef<int> VectorMask, SDValue VecIn1,
+                                  SDValue VecIn2, unsigned LeftIdx);
 
     SDValue GetDemandedBits(SDValue V, const APInt &Mask);
 
@@ -13010,7 +13010,7 @@ SDValue DAGCombiner::reduceBuildVecConvertToConvertBuildVec(SDNode *N) {
   return DAG.getNode(Opcode, DL, VT, BV);
 }
 
-SDValue DAGCombiner::createBuildVecShuffle(SDLoc DL, SDNode *N,
+SDValue DAGCombiner::createBuildVecShuffle(const SDLoc &DL, SDNode *N,
                                            ArrayRef<int> VectorMask,
                                            SDValue VecIn1, SDValue VecIn2,
                                            unsigned LeftIdx) {
index 4e5ad2fad01fdff7972298ac8b0d29d85bcf860a..c1eef4dced0dbb2302273c1daffec1e543e975d1 100644 (file)
@@ -4764,7 +4764,7 @@ bool SelectionDAGBuilder::EmitFuncArgumentDbgValue(
 SDDbgValue *SelectionDAGBuilder::getDbgValue(SDValue N,
                                              DILocalVariable *Variable,
                                              DIExpression *Expr, int64_t Offset,
-                                             DebugLoc dl,
+                                             const DebugLoc &dl,
                                              unsigned DbgSDNodeOrder) {
   SDDbgValue *SDV;
   auto *FISDN = dyn_cast<FrameIndexSDNode>(N.getNode());
index abde8a89befce785b90094caffc11f94f8418d1d..f0fea4bb1428a6274dd05501a9dc4d76f75b7569 100644 (file)
@@ -944,8 +944,8 @@ private:
 
   /// Return the appropriate SDDbgValue based on N.
   SDDbgValue *getDbgValue(SDValue N, DILocalVariable *Variable,
-                          DIExpression *Expr, int64_t Offset, DebugLoc dl,
-                          unsigned DbgSDNodeOrder);
+                          DIExpression *Expr, int64_t Offset,
+                          const DebugLoc &dl, unsigned DbgSDNodeOrder);
 };
 
 /// RegsForValue - This struct represents the registers (physical or virtual)
index c7f72551dc8ba9290a1aceb01f11e39153291b9d..aec9e2d904fbe1c7dbdde5815a3d30baf45b75c2 100644 (file)
@@ -71,7 +71,7 @@ TypeIndex TypeDatabase::getNextTypeIndex() const {
 }
 
 /// Records the name of a type, and reserves its type index.
-void TypeDatabase::recordType(StringRef Name, CVType Data) {
+void TypeDatabase::recordType(StringRef Name, const CVType &Data) {
   CVUDTNames.push_back(Name);
   TypeRecords.push_back(Data);
 }
index fd5bdb0bc01a12129535a174278ea1c32bb8fdaa..f635369df8d751039224ae2960b053e399ddff2a 100644 (file)
@@ -46,7 +46,7 @@ static void commitEntry(StringRef TempFilename, StringRef EntryPath) {
   }
 }
 
-NativeObjectCache lto::localCache(std::string CacheDirectoryPath,
+NativeObjectCache lto::localCache(StringRef CacheDirectoryPath,
                                   AddFileFn AddFile) {
   return [=](unsigned Task, StringRef Key) -> AddStreamFn {
     // First, see if we have a cache hit.
@@ -68,8 +68,9 @@ NativeObjectCache lto::localCache(std::string CacheDirectoryPath,
       CacheStream(std::unique_ptr<raw_pwrite_stream> OS, AddFileFn AddFile,
                   std::string TempFilename, std::string EntryPath,
                   unsigned Task)
-          : NativeObjectStream(std::move(OS)), AddFile(AddFile),
-            TempFilename(TempFilename), EntryPath(EntryPath), Task(Task) {}
+          : NativeObjectStream(std::move(OS)), AddFile(std::move(AddFile)),
+            TempFilename(std::move(TempFilename)),
+            EntryPath(std::move(EntryPath)), Task(Task) {}
 
       ~CacheStream() {
         // Make sure the file is closed before committing it.
index 98f4daf972d63989873bcf110b26edf3b9691811..be1d7f29ea6d3e32b0768eb4e3a3e964831a1d31 100644 (file)
@@ -118,7 +118,7 @@ bool MCAsmParser::addErrorSuffix(const Twine &Suffix) {
   return true;
 }
 
-bool MCAsmParser::parseMany(std::function<bool()> parseOne, bool hasComma) {
+bool MCAsmParser::parseMany(function_ref<bool()> parseOne, bool hasComma) {
   if (parseOptionalToken(AsmToken::EndOfStatement))
     return false;
   while (1) {
index 75153cca444d5aee3c73da046dd8f751d89f81b5..cd8ec784613b3fbf623ab6140c9f4c9c95b9a814 100644 (file)
@@ -129,11 +129,10 @@ struct OutgoingArgHandler : public CallLowering::ValueHandler {
   MachineInstrBuilder MIB;
 };
 
-void AArch64CallLowering::splitToValueTypes(const ArgInfo &OrigArg,
-                                            SmallVectorImpl<ArgInfo> &SplitArgs,
-                                            const DataLayout &DL,
-                                            MachineRegisterInfo &MRI,
-                                            SplitArgTy PerformArgSplit) const {
+void AArch64CallLowering::splitToValueTypes(
+    const ArgInfo &OrigArg, SmallVectorImpl<ArgInfo> &SplitArgs,
+    const DataLayout &DL, MachineRegisterInfo &MRI,
+    const SplitArgTy &PerformArgSplit) const {
   const AArch64TargetLowering &TLI = *getTLI<AArch64TargetLowering>();
   LLVMContext &Ctx = OrigArg.Ty->getContext();
 
index ce6676249df6a00e4196676222dc7daff1126f01..d1453d0071f9cb12d1f482e6dab4ae07731d71b6 100644 (file)
@@ -50,7 +50,7 @@ private:
   void splitToValueTypes(const ArgInfo &OrigArgInfo,
                          SmallVectorImpl<ArgInfo> &SplitArgs,
                          const DataLayout &DL, MachineRegisterInfo &MRI,
-                         SplitArgTy SplitArg) const;
+                         const SplitArgTy &SplitArg) const;
 };
 } // End of namespace llvm;
 #endif
index 3392183d33c3dc81d53b1ecc40654fe143b9092e..9be6d5160c6c938235b931c81ab6c0f859641ef0 100644 (file)
@@ -116,10 +116,9 @@ MCELFStreamer &AMDGPUTargetELFStreamer::getStreamer() {
   return static_cast<MCELFStreamer &>(Streamer);
 }
 
-void
-AMDGPUTargetELFStreamer::EmitAMDGPUNote(const MCExpr* DescSZ,
-                                        PT_NOTE::NoteType Type,
-                              std::function<void(MCELFStreamer &)> EmitDesc) {
+void AMDGPUTargetELFStreamer::EmitAMDGPUNote(
+    const MCExpr *DescSZ, PT_NOTE::NoteType Type,
+    function_ref<void(MCELFStreamer &)> EmitDesc) {
   auto &S = getStreamer();
   auto &Context = S.getContext();
 
index e2f20586903d200e85b38389a8d8a1b32f019134..6407f5e3ee7a1f5f818002fa639c5e9db1cecb40 100644 (file)
@@ -78,9 +78,8 @@ public:
 class AMDGPUTargetELFStreamer : public AMDGPUTargetStreamer {
   MCStreamer &Streamer;
 
-  void EmitAMDGPUNote(const MCExpr* DescSize,
-                      AMDGPU::PT_NOTE::NoteType Type,
-                      std::function<void(MCELFStreamer &)> EmitDesc);
+  void EmitAMDGPUNote(const MCExpr *DescSize, AMDGPU::PT_NOTE::NoteType Type,
+                      function_ref<void(MCELFStreamer &)> EmitDesc);
 
 public:
   AMDGPUTargetELFStreamer(MCStreamer &S);
index 4c0c04cb253da07d48cda0ae9ae96d569b91d3f8..f17af6dc7619110eabbbebf38ae3206875c3acd3 100644 (file)
@@ -2212,9 +2212,10 @@ SITargetLowering::isOffsetFoldingLegal(const GlobalAddressSDNode *GA) const {
          !shouldEmitGOTReloc(GA->getGlobal());
 }
 
-static SDValue buildPCRelGlobalAddress(SelectionDAG &DAG, const GlobalValue *GV,
-                                      SDLoc DL, unsigned Offset, EVT PtrVT,
-                                      unsigned GAFlags = SIInstrInfo::MO_NONE) {
+static SDValue
+buildPCRelGlobalAddress(SelectionDAG &DAG, const GlobalValue *GV,
+                        const SDLoc &DL, unsigned Offset, EVT PtrVT,
+                        unsigned GAFlags = SIInstrInfo::MO_NONE) {
   // In order to support pc-relative addressing, the PC_ADD_REL_OFFSET SDNode is
   // lowered to the following code sequence:
   //
@@ -2332,7 +2333,8 @@ SDValue SITargetLowering::lowerImplicitZextParam(SelectionDAG &DAG,
                      DAG.getValueType(VT));
 }
 
-static SDValue emitNonHSAIntrinsicError(SelectionDAG& DAG, SDLoc DL, EVT VT) {
+static SDValue emitNonHSAIntrinsicError(SelectionDAG &DAG, const SDLoc &DL,
+                                        EVT VT) {
   DiagnosticInfoUnsupported BadIntrin(*DAG.getMachineFunction().getFunction(),
                                       "non-hsa intrinsic with hsa target",
                                       DL.getDebugLoc());
@@ -2340,7 +2342,8 @@ static SDValue emitNonHSAIntrinsicError(SelectionDAG& DAG, SDLoc DL, EVT VT) {
   return DAG.getUNDEF(VT);
 }
 
-static SDValue emitRemovedIntrinsicError(SelectionDAG& DAG, SDLoc DL, EVT VT) {
+static SDValue emitRemovedIntrinsicError(SelectionDAG &DAG, const SDLoc &DL,
+                                         EVT VT) {
   DiagnosticInfoUnsupported BadIntrin(*DAG.getMachineFunction().getFunction(),
                                       "intrinsic not supported on subtarget",
                                       DL.getDebugLoc());
index 1768a54d86a65c111695334a10f33bd1243fa20d..4b5fa4bb8c59def55700e06c3461044227f17d51 100644 (file)
@@ -30,7 +30,7 @@ using namespace llvm;
 ARMCallLowering::ARMCallLowering(const ARMTargetLowering &TLI)
     : CallLowering(&TLI) {}
 
-static bool isSupportedType(const DataLayout DL, const ARMTargetLowering &TLI,
+static bool isSupportedType(const DataLayout &DL, const ARMTargetLowering &TLI,
                             Type *T) {
   EVT VT = TLI.getValueType(DL, T);
   if (!VT.isSimple() || !VT.isInteger() || VT.isVector())
index 88755589d43434c41d6871897975d991faea73bd..25716807d74aedc80c31897ac8261e5e337e2786 100644 (file)
@@ -3084,7 +3084,7 @@ static bool isSimpleType(Type *T) {
 }
 
 static SDValue promoteToConstantPool(const GlobalValue *GV, SelectionDAG &DAG,
-                                     EVT PtrVT, SDLoc dl) {
+                                     EVT PtrVT, const SDLoc &dl) {
   // If we're creating a pool entry for a constant global with unnamed address,
   // and the global is small enough, we can emit it inline into the constant pool
   // to save ourselves an indirection.
index 886782e49c5b64750bf434eb15eb6a208af68273..20885d886d12d14cc19fe0d5f4bbe861e8ac7d02 100644 (file)
@@ -6376,7 +6376,7 @@ static SDValue EltsFromConsecutiveLoads(EVT VT, ArrayRef<SDValue> Elts,
   return SDValue();
 }
 
-static Constant *getConstantVector(MVT VT, APInt SplatValue,
+static Constant *getConstantVector(MVT VT, const APInt &SplatValue,
                                    unsigned SplatBitSize, LLVMContext &C) {
   unsigned ScalarSize = VT.getScalarSizeInBits();
   unsigned NumElm = SplatBitSize / ScalarSize;
@@ -8009,7 +8009,7 @@ static unsigned getV4X86ShuffleImm(ArrayRef<int> Mask) {
   return Imm;
 }
 
-static SDValue getV4X86ShuffleImm8ForMask(ArrayRef<int> Mask, SDLoc DL,
+static SDValue getV4X86ShuffleImm8ForMask(ArrayRef<int> Mask, const SDLoc &DL,
                                           SelectionDAG &DAG) {
   return DAG.getConstant(getV4X86ShuffleImm(Mask), DL, MVT::i8);
 }
@@ -8096,8 +8096,8 @@ static SmallBitVector computeZeroableShuffleElements(ArrayRef<int> Mask,
 //
 // The function looks for a sub-mask that the nonzero elements are in
 // increasing order. If such sub-mask exist. The function returns true.
-static bool isNonZeroElementsInOrder(const SmallBitVector Zeroable,
-                                     ArrayRef<int> Mask,const EVT &VectorType,
+static bool isNonZeroElementsInOrder(const SmallBitVector &Zeroable,
+                                     ArrayRef<int> Mask, const EVT &VectorType,
                                      bool &IsZeroSideLeft) {
   int NextElement = -1;
   // Check if the Mask's nonzero elements are in increasing order.
@@ -12921,7 +12921,7 @@ static SDValue lowerV8F64VectorShuffle(const SDLoc &DL, ArrayRef<int> Mask,
 }
 
 /// \brief Handle lowering of 16-lane 32-bit floating point shuffles.
-static SDValue lowerV16F32VectorShuffle(SDLoc DL, ArrayRef<int> Mask,
+static SDValue lowerV16F32VectorShuffle(const SDLoc &DL, ArrayRef<int> Mask,
                                         const SmallBitVector &Zeroable,
                                         SDValue V1, SDValue V2,
                                         const X86Subtarget &Subtarget,
index 1770445b413f63f2e25d00208937e957eab3270b..cdb04c197368c9808d60cd33d9a36ab320cb2408 100644 (file)
@@ -48,7 +48,7 @@ public:
   }
 
   explicit SimpleInliner(InlineParams Params)
-      : LegacyInlinerBase(ID), Params(Params) {
+      : LegacyInlinerBase(ID), Params(std::move(Params)) {
     initializeSimpleInlinerPass(*PassRegistry::getPassRegistry());
   }
 
index 7ef3fc1fc2a7f04410c225ad90bbde3080b3e463..a2f6e5639d9d48a6859bf994e35e8acbd01c0827 100644 (file)
@@ -33,7 +33,7 @@ STATISTIC(NumPartialInlined, "Number of functions partially inlined");
 
 namespace {
 struct PartialInlinerImpl {
-  PartialInlinerImpl(InlineFunctionInfo IFI) : IFI(IFI) {}
+  PartialInlinerImpl(InlineFunctionInfo IFI) : IFI(std::move(IFI)) {}
   bool run(Module &M);
   Function *unswitchFunction(Function *F);
 
index 3680cfc813a180d388277d2926bff58dc530b96f..30d91095c704a52ce4f6df7e977b08a50b59a170 100644 (file)
@@ -194,7 +194,7 @@ void simplifyExternals(Module &M) {
 }
 
 void filterModule(
-    Module *M, std::function<bool(const GlobalValue *)> ShouldKeepDefinition) {
+    Module *M, function_ref<bool(const GlobalValue *)> ShouldKeepDefinition) {
   for (Function &F : *M) {
     if (ShouldKeepDefinition(&F))
       continue;
index 38262514c9ec40d2f1d86c129d1dc6a7b11a57a7..12a842b6ddb3d3f62a929a0226fef9d6e7a051e6 100644 (file)
@@ -289,8 +289,8 @@ void ConstantHoistingPass::collectConstantCandidates(Function &Fn) {
 // bit widths (APInt Operator- does not like that). If the value cannot be
 // represented in uint64 we return an "empty" APInt. This is then interpreted
 // as the value is not in range.
-static llvm::Optional<APInt> calculateOffsetDiff(APInt V1, APInt V2)
-{
+static llvm::Optional<APInt> calculateOffsetDiff(const APInt &V1,
+                                                 const APInt &V2) {
   llvm::Optional<APInt> Res = None;
   unsigned BW = V1.getBitWidth() > V2.getBitWidth() ?
                 V1.getBitWidth() : V2.getBitWidth();
index 1de742050cb33fc6ed7be5fc5bee9c79cc6d443a..13c3549c238b74affed6e6eb10aec5ca033f4fef 100644 (file)
@@ -634,7 +634,7 @@ static BDVState meetBDVStateImpl(const BDVState &LHS, const BDVState &RHS) {
 
 // Values of type BDVState form a lattice, and this function implements the meet
 // operation.
-static BDVState meetBDVState(BDVState LHS, BDVState RHS) {
+static BDVState meetBDVState(const BDVState &LHS, const BDVState &RHS) {
   BDVState Result = meetBDVStateImpl(LHS, RHS);
   assert(Result == meetBDVStateImpl(RHS, LHS) &&
          "Math is wrong: meet does not commute!");