From 5fd769f79163f06f73803198bfd059c5b397848f Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Fri, 13 Jan 2017 14:39:03 +0000 Subject: [PATCH] Apply clang-tidy's performance-unnecessary-value-param to LLVM. With some minor manual fixes for using function_ref instead of std::function. No functional change intended. llvm-svn: 291904 --- include/llvm/CodeGen/GlobalISel/LegalizerInfo.h | 2 +- include/llvm/CodeGen/MIRYamlMapping.h | 2 +- include/llvm/CodeGen/RegAllocPBQP.h | 2 +- include/llvm/CodeGen/SelectionDAG.h | 2 +- include/llvm/DebugInfo/CodeView/SymbolRecord.h | 2 +- include/llvm/DebugInfo/CodeView/TypeDatabase.h | 2 +- include/llvm/IR/IRBuilder.h | 2 +- include/llvm/LTO/Caching.h | 2 +- include/llvm/MC/MCParser/MCAsmParser.h | 2 +- include/llvm/MC/MCParser/MCAsmParserExtension.h | 2 +- include/llvm/Target/TargetMachine.h | 4 ++-- lib/Analysis/CFLAndersAliasAnalysis.cpp | 4 ++-- lib/Bitcode/Reader/MetadataLoader.cpp | 10 +++++----- lib/CodeGen/GlobalISel/MachineIRBuilder.cpp | 2 +- lib/CodeGen/LLVMTargetMachine.cpp | 2 +- lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 8 ++++---- lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp | 2 +- lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h | 4 ++-- lib/DebugInfo/CodeView/TypeDatabase.cpp | 2 +- lib/LTO/Caching.cpp | 7 ++++--- lib/MC/MCParser/MCAsmParser.cpp | 2 +- lib/Target/AArch64/AArch64CallLowering.cpp | 9 ++++----- lib/Target/AArch64/AArch64CallLowering.h | 2 +- .../AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.cpp | 7 +++---- .../AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.h | 5 ++--- lib/Target/AMDGPU/SIISelLowering.cpp | 13 ++++++++----- lib/Target/ARM/ARMCallLowering.cpp | 2 +- lib/Target/ARM/ARMISelLowering.cpp | 2 +- lib/Target/X86/X86ISelLowering.cpp | 10 +++++----- lib/Transforms/IPO/InlineSimple.cpp | 2 +- lib/Transforms/IPO/PartialInlining.cpp | 2 +- lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp | 2 +- lib/Transforms/Scalar/ConstantHoisting.cpp | 4 ++-- lib/Transforms/Scalar/RewriteStatepointsForGC.cpp | 2 +- 34 files changed, 65 insertions(+), 64 deletions(-) diff --git a/include/llvm/CodeGen/GlobalISel/LegalizerInfo.h b/include/llvm/CodeGen/GlobalISel/LegalizerInfo.h index edf52daf3f8..4a9e535090c 100644 --- a/include/llvm/CodeGen/GlobalISel/LegalizerInfo.h +++ b/include/llvm/CodeGen/GlobalISel/LegalizerInfo.h @@ -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 NextType) const { + function_ref NextType) const { LegalizeAction Action; const TypeMap &Map = Actions[Aspect.Opcode - FirstOp][Aspect.Idx]; LLT Ty = Aspect.Type; diff --git a/include/llvm/CodeGen/MIRYamlMapping.h b/include/llvm/CodeGen/MIRYamlMapping.h index 778f72c06e6..05d0429ab63 100644 --- a/include/llvm/CodeGen/MIRYamlMapping.h +++ b/include/llvm/CodeGen/MIRYamlMapping.h @@ -55,7 +55,7 @@ template <> struct ScalarTraits { struct FlowStringValue : StringValue { FlowStringValue() {} - FlowStringValue(std::string Value) : StringValue(Value) {} + FlowStringValue(std::string Value) : StringValue(std::move(Value)) {} }; template <> struct ScalarTraits { diff --git a/include/llvm/CodeGen/RegAllocPBQP.h b/include/llvm/CodeGen/RegAllocPBQP.h index 2cad90bbb70..d458bd95f68 100644 --- a/include/llvm/CodeGen/RegAllocPBQP.h +++ b/include/llvm/CodeGen/RegAllocPBQP.h @@ -496,7 +496,7 @@ class PBQPRAGraph : public PBQP::Graph { private: typedef PBQP::Graph BaseT; public: - PBQPRAGraph(GraphMetadata Metadata) : BaseT(Metadata) {} + PBQPRAGraph(GraphMetadata Metadata) : BaseT(std::move(Metadata)) {} /// @brief Dump this graph to dbgs(). void dump() const; diff --git a/include/llvm/CodeGen/SelectionDAG.h b/include/llvm/CodeGen/SelectionDAG.h index 54d0436e4ab..5a291c79c93 100644 --- a/include/llvm/CodeGen/SelectionDAG.h +++ b/include/llvm/CodeGen/SelectionDAG.h @@ -239,7 +239,7 @@ public: std::function Callback; DAGNodeDeletedListener(SelectionDAG &DAG, std::function Callback) - : DAGUpdateListener(DAG), Callback(Callback) {} + : DAGUpdateListener(DAG), Callback(std::move(Callback)) {} void NodeDeleted(SDNode *N, SDNode *E) override { Callback(N, E); } }; diff --git a/include/llvm/DebugInfo/CodeView/SymbolRecord.h b/include/llvm/DebugInfo/CodeView/SymbolRecord.h index 57772d39e97..2c3648ad28a 100644 --- a/include/llvm/DebugInfo/CodeView/SymbolRecord.h +++ b/include/llvm/DebugInfo/CodeView/SymbolRecord.h @@ -176,7 +176,7 @@ struct BinaryAnnotationIterator { return Data == Other.Data; } - bool operator!=(BinaryAnnotationIterator Other) const { + bool operator!=(const BinaryAnnotationIterator &Other) const { return !(*this == Other); } diff --git a/include/llvm/DebugInfo/CodeView/TypeDatabase.h b/include/llvm/DebugInfo/CodeView/TypeDatabase.h index cccc2868ffb..c00d3b79420 100644 --- a/include/llvm/DebugInfo/CodeView/TypeDatabase.h +++ b/include/llvm/DebugInfo/CodeView/TypeDatabase.h @@ -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); diff --git a/include/llvm/IR/IRBuilder.h b/include/llvm/IR/IRBuilder.h index 1d9c16989de..5a41b5a2ed6 100644 --- a/include/llvm/IR/IRBuilder.h +++ b/include/llvm/IR/IRBuilder.h @@ -75,7 +75,7 @@ class IRBuilderCallbackInserter : IRBuilderDefaultInserter { public: IRBuilderCallbackInserter(std::function Callback) - : Callback(Callback) {} + : Callback(std::move(Callback)) {} protected: void InsertHelper(Instruction *I, const Twine &Name, diff --git a/include/llvm/LTO/Caching.h b/include/llvm/LTO/Caching.h index 3b96bd1dc30..769f4cd9cc7 100644 --- a/include/llvm/LTO/Caching.h +++ b/include/llvm/LTO/Caching.h @@ -29,7 +29,7 @@ typedef std::function 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 diff --git a/include/llvm/MC/MCParser/MCAsmParser.h b/include/llvm/MC/MCParser/MCAsmParser.h index eb85a3a3096..c289f51f43f 100644 --- a/include/llvm/MC/MCParser/MCAsmParser.h +++ b/include/llvm/MC/MCParser/MCAsmParser.h @@ -186,7 +186,7 @@ public: bool parseEOL(const Twine &ErrMsg); - bool parseMany(std::function parseOne, bool hasComma = true); + bool parseMany(function_ref parseOne, bool hasComma = true); bool parseIntToken(int64_t &V, const Twine &ErrMsg); diff --git a/include/llvm/MC/MCParser/MCAsmParserExtension.h b/include/llvm/MC/MCParser/MCAsmParserExtension.h index dabda0ab948..7817d41c017 100644 --- a/include/llvm/MC/MCParser/MCAsmParserExtension.h +++ b/include/llvm/MC/MCParser/MCAsmParserExtension.h @@ -85,7 +85,7 @@ public: return getParser().parseToken(T, Msg); } - bool parseMany(std::function parseOne, bool hasComma = true) { + bool parseMany(function_ref parseOne, bool hasComma = true) { return getParser().parseMany(parseOne, hasComma); } diff --git a/include/llvm/Target/TargetMachine.h b/include/llvm/Target/TargetMachine.h index b1d8f8f1e91..013e58ee415 100644 --- a/include/llvm/Target/TargetMachine.h +++ b/include/llvm/Target/TargetMachine.h @@ -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: diff --git a/lib/Analysis/CFLAndersAliasAnalysis.cpp b/lib/Analysis/CFLAndersAliasAnalysis.cpp index e48ff230f43..ddd5123d0ef 100644 --- a/lib/Analysis/CFLAndersAliasAnalysis.cpp +++ b/lib/Analysis/CFLAndersAliasAnalysis.cpp @@ -307,7 +307,7 @@ class CFLAndersAAResult::FunctionInfo { public: FunctionInfo(const Function &, const SmallVectorImpl &, - 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 &RetVals, - const ReachabilitySet &ReachSet, AliasAttrMap AMap) { + const ReachabilitySet &ReachSet, const AliasAttrMap &AMap) { populateAttrMap(AttrMap, AMap); populateExternalAttributes(Summary.RetParamAttributes, Fn, RetVals, AMap); populateAliasMap(AliasMap, ReachSet); diff --git a/lib/Bitcode/Reader/MetadataLoader.cpp b/lib/Bitcode/Reader/MetadataLoader.cpp index 4a5d18e2db7..47019c50ba0 100644 --- a/lib/Bitcode/Reader/MetadataLoader.cpp +++ b/lib/Bitcode/Reader/MetadataLoader.cpp @@ -456,7 +456,7 @@ class MetadataLoader::MetadataLoaderImpl { PlaceholderQueue &Placeholders, StringRef Blob, unsigned &NextMetadataNo); Error parseMetadataStrings(ArrayRef Record, StringRef Blob, - std::function CallBack); + function_ref CallBack); Error parseGlobalObjectAttachment(GlobalObject &GO, ArrayRef Record); Error parseMetadataKindRecord(SmallVectorImpl &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 Record, StringRef Blob, - std::function CallBack) { + function_ref 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 getTypeByID) - : Pimpl(llvm::make_unique(Stream, TheModule, ValueList, - getTypeByID, IsImporting)) {} + : Pimpl(llvm::make_unique( + Stream, TheModule, ValueList, std::move(getTypeByID), IsImporting)) {} Error MetadataLoader::parseMetadata(bool ModuleLevel) { return Pimpl->parseMetadata(ModuleLevel); diff --git a/lib/CodeGen/GlobalISel/MachineIRBuilder.cpp b/lib/CodeGen/GlobalISel/MachineIRBuilder.cpp index c04f6e4ae89..70a992d3693 100644 --- a/lib/CodeGen/GlobalISel/MachineIRBuilder.cpp +++ b/lib/CodeGen/GlobalISel/MachineIRBuilder.cpp @@ -54,7 +54,7 @@ void MachineIRBuilder::setInsertPt(MachineBasicBlock &MBB, void MachineIRBuilder::recordInsertions( std::function Inserted) { - InsertedInstr = Inserted; + InsertedInstr = std::move(Inserted); } void MachineIRBuilder::stopRecordingInsertions() { diff --git a/lib/CodeGen/LLVMTargetMachine.cpp b/lib/CodeGen/LLVMTargetMachine.cpp index 26794e28020..cb79d3acdec 100644 --- a/lib/CodeGen/LLVMTargetMachine.cpp +++ b/lib/CodeGen/LLVMTargetMachine.cpp @@ -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) { diff --git a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index 680f62fa91b..fb64fa3667f 100644 --- a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -384,9 +384,9 @@ namespace { SDValue reduceBuildVecExtToExtBuildVec(SDNode *N); SDValue reduceBuildVecConvertToConvertBuildVec(SDNode *N); SDValue reduceBuildVecToShuffle(SDNode *N); - SDValue createBuildVecShuffle(SDLoc DL, SDNode *N, ArrayRef VectorMask, - SDValue VecIn1, SDValue VecIn2, - unsigned LeftIdx); + SDValue createBuildVecShuffle(const SDLoc &DL, SDNode *N, + ArrayRef 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 VectorMask, SDValue VecIn1, SDValue VecIn2, unsigned LeftIdx) { diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp index 4e5ad2fad01..c1eef4dced0 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp @@ -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(N.getNode()); diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h b/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h index abde8a89bef..f0fea4bb142 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h +++ b/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h @@ -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) diff --git a/lib/DebugInfo/CodeView/TypeDatabase.cpp b/lib/DebugInfo/CodeView/TypeDatabase.cpp index c7f72551dc8..aec9e2d904f 100644 --- a/lib/DebugInfo/CodeView/TypeDatabase.cpp +++ b/lib/DebugInfo/CodeView/TypeDatabase.cpp @@ -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); } diff --git a/lib/LTO/Caching.cpp b/lib/LTO/Caching.cpp index fd5bdb0bc01..f635369df8d 100644 --- a/lib/LTO/Caching.cpp +++ b/lib/LTO/Caching.cpp @@ -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 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. diff --git a/lib/MC/MCParser/MCAsmParser.cpp b/lib/MC/MCParser/MCAsmParser.cpp index 98f4daf972d..be1d7f29ea6 100644 --- a/lib/MC/MCParser/MCAsmParser.cpp +++ b/lib/MC/MCParser/MCAsmParser.cpp @@ -118,7 +118,7 @@ bool MCAsmParser::addErrorSuffix(const Twine &Suffix) { return true; } -bool MCAsmParser::parseMany(std::function parseOne, bool hasComma) { +bool MCAsmParser::parseMany(function_ref parseOne, bool hasComma) { if (parseOptionalToken(AsmToken::EndOfStatement)) return false; while (1) { diff --git a/lib/Target/AArch64/AArch64CallLowering.cpp b/lib/Target/AArch64/AArch64CallLowering.cpp index 75153cca444..cd8ec784613 100644 --- a/lib/Target/AArch64/AArch64CallLowering.cpp +++ b/lib/Target/AArch64/AArch64CallLowering.cpp @@ -129,11 +129,10 @@ struct OutgoingArgHandler : public CallLowering::ValueHandler { MachineInstrBuilder MIB; }; -void AArch64CallLowering::splitToValueTypes(const ArgInfo &OrigArg, - SmallVectorImpl &SplitArgs, - const DataLayout &DL, - MachineRegisterInfo &MRI, - SplitArgTy PerformArgSplit) const { +void AArch64CallLowering::splitToValueTypes( + const ArgInfo &OrigArg, SmallVectorImpl &SplitArgs, + const DataLayout &DL, MachineRegisterInfo &MRI, + const SplitArgTy &PerformArgSplit) const { const AArch64TargetLowering &TLI = *getTLI(); LLVMContext &Ctx = OrigArg.Ty->getContext(); diff --git a/lib/Target/AArch64/AArch64CallLowering.h b/lib/Target/AArch64/AArch64CallLowering.h index ce6676249df..d1453d0071f 100644 --- a/lib/Target/AArch64/AArch64CallLowering.h +++ b/lib/Target/AArch64/AArch64CallLowering.h @@ -50,7 +50,7 @@ private: void splitToValueTypes(const ArgInfo &OrigArgInfo, SmallVectorImpl &SplitArgs, const DataLayout &DL, MachineRegisterInfo &MRI, - SplitArgTy SplitArg) const; + const SplitArgTy &SplitArg) const; }; } // End of namespace llvm; #endif diff --git a/lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.cpp b/lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.cpp index 3392183d33c..9be6d5160c6 100644 --- a/lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.cpp +++ b/lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.cpp @@ -116,10 +116,9 @@ MCELFStreamer &AMDGPUTargetELFStreamer::getStreamer() { return static_cast(Streamer); } -void -AMDGPUTargetELFStreamer::EmitAMDGPUNote(const MCExpr* DescSZ, - PT_NOTE::NoteType Type, - std::function EmitDesc) { +void AMDGPUTargetELFStreamer::EmitAMDGPUNote( + const MCExpr *DescSZ, PT_NOTE::NoteType Type, + function_ref EmitDesc) { auto &S = getStreamer(); auto &Context = S.getContext(); diff --git a/lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.h b/lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.h index e2f20586903..6407f5e3ee7 100644 --- a/lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.h +++ b/lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.h @@ -78,9 +78,8 @@ public: class AMDGPUTargetELFStreamer : public AMDGPUTargetStreamer { MCStreamer &Streamer; - void EmitAMDGPUNote(const MCExpr* DescSize, - AMDGPU::PT_NOTE::NoteType Type, - std::function EmitDesc); + void EmitAMDGPUNote(const MCExpr *DescSize, AMDGPU::PT_NOTE::NoteType Type, + function_ref EmitDesc); public: AMDGPUTargetELFStreamer(MCStreamer &S); diff --git a/lib/Target/AMDGPU/SIISelLowering.cpp b/lib/Target/AMDGPU/SIISelLowering.cpp index 4c0c04cb253..f17af6dc761 100644 --- a/lib/Target/AMDGPU/SIISelLowering.cpp +++ b/lib/Target/AMDGPU/SIISelLowering.cpp @@ -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()); diff --git a/lib/Target/ARM/ARMCallLowering.cpp b/lib/Target/ARM/ARMCallLowering.cpp index 1768a54d86a..4b5fa4bb8c5 100644 --- a/lib/Target/ARM/ARMCallLowering.cpp +++ b/lib/Target/ARM/ARMCallLowering.cpp @@ -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()) diff --git a/lib/Target/ARM/ARMISelLowering.cpp b/lib/Target/ARM/ARMISelLowering.cpp index 88755589d43..25716807d74 100644 --- a/lib/Target/ARM/ARMISelLowering.cpp +++ b/lib/Target/ARM/ARMISelLowering.cpp @@ -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. diff --git a/lib/Target/X86/X86ISelLowering.cpp b/lib/Target/X86/X86ISelLowering.cpp index 886782e49c5..20885d886d1 100644 --- a/lib/Target/X86/X86ISelLowering.cpp +++ b/lib/Target/X86/X86ISelLowering.cpp @@ -6376,7 +6376,7 @@ static SDValue EltsFromConsecutiveLoads(EVT VT, ArrayRef 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 Mask) { return Imm; } -static SDValue getV4X86ShuffleImm8ForMask(ArrayRef Mask, SDLoc DL, +static SDValue getV4X86ShuffleImm8ForMask(ArrayRef Mask, const SDLoc &DL, SelectionDAG &DAG) { return DAG.getConstant(getV4X86ShuffleImm(Mask), DL, MVT::i8); } @@ -8096,8 +8096,8 @@ static SmallBitVector computeZeroableShuffleElements(ArrayRef 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 Mask,const EVT &VectorType, +static bool isNonZeroElementsInOrder(const SmallBitVector &Zeroable, + ArrayRef 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 Mask, } /// \brief Handle lowering of 16-lane 32-bit floating point shuffles. -static SDValue lowerV16F32VectorShuffle(SDLoc DL, ArrayRef Mask, +static SDValue lowerV16F32VectorShuffle(const SDLoc &DL, ArrayRef Mask, const SmallBitVector &Zeroable, SDValue V1, SDValue V2, const X86Subtarget &Subtarget, diff --git a/lib/Transforms/IPO/InlineSimple.cpp b/lib/Transforms/IPO/InlineSimple.cpp index 1770445b413..cdb04c19736 100644 --- a/lib/Transforms/IPO/InlineSimple.cpp +++ b/lib/Transforms/IPO/InlineSimple.cpp @@ -48,7 +48,7 @@ public: } explicit SimpleInliner(InlineParams Params) - : LegacyInlinerBase(ID), Params(Params) { + : LegacyInlinerBase(ID), Params(std::move(Params)) { initializeSimpleInlinerPass(*PassRegistry::getPassRegistry()); } diff --git a/lib/Transforms/IPO/PartialInlining.cpp b/lib/Transforms/IPO/PartialInlining.cpp index 7ef3fc1fc2a..a2f6e5639d9 100644 --- a/lib/Transforms/IPO/PartialInlining.cpp +++ b/lib/Transforms/IPO/PartialInlining.cpp @@ -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); diff --git a/lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp b/lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp index 3680cfc813a..30d91095c70 100644 --- a/lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp +++ b/lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp @@ -194,7 +194,7 @@ void simplifyExternals(Module &M) { } void filterModule( - Module *M, std::function ShouldKeepDefinition) { + Module *M, function_ref ShouldKeepDefinition) { for (Function &F : *M) { if (ShouldKeepDefinition(&F)) continue; diff --git a/lib/Transforms/Scalar/ConstantHoisting.cpp b/lib/Transforms/Scalar/ConstantHoisting.cpp index 38262514c9e..12a842b6ddb 100644 --- a/lib/Transforms/Scalar/ConstantHoisting.cpp +++ b/lib/Transforms/Scalar/ConstantHoisting.cpp @@ -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 calculateOffsetDiff(APInt V1, APInt V2) -{ +static llvm::Optional calculateOffsetDiff(const APInt &V1, + const APInt &V2) { llvm::Optional Res = None; unsigned BW = V1.getBitWidth() > V2.getBitWidth() ? V1.getBitWidth() : V2.getBitWidth(); diff --git a/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp b/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp index 1de742050cb..13c3549c238 100644 --- a/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp +++ b/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp @@ -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!");