From c321e534022768d424cf5c5ab43f99489e55bf07 Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Wed, 8 Jun 2016 19:09:22 +0000 Subject: [PATCH] Apply most suggestions of clang-tidy's performance-unnecessary-value-param Avoids unnecessary copies. All changes audited & pass tests with asan. No functional change intended. llvm-svn: 272190 --- llvm/include/llvm/ADT/APInt.h | 2 +- .../llvm/Analysis/ScalarEvolutionExpressions.h | 4 ++-- llvm/include/llvm/Analysis/TargetLibraryInfo.h | 2 +- llvm/include/llvm/DebugInfo/Symbolize/DIPrinter.h | 2 +- .../llvm/ExecutionEngine/Orc/IndirectionUtils.h | 5 +++-- llvm/include/llvm/LTO/LTOCodeGenerator.h | 2 +- llvm/include/llvm/LTO/LTOModule.h | 15 +++++++++------ llvm/include/llvm/MC/MCObjectFileInfo.h | 6 +++--- llvm/include/llvm/ProfileData/SampleProf.h | 4 ++-- llvm/include/llvm/Support/CommandLine.h | 2 +- llvm/include/llvm/Support/ScopedPrinter.h | 2 +- llvm/lib/Analysis/DependenceAnalysis.cpp | 13 ++++--------- llvm/lib/Analysis/LazyValueInfo.cpp | 2 +- llvm/lib/Analysis/Loads.cpp | 4 ++-- llvm/lib/Analysis/ScalarEvolution.cpp | 2 +- llvm/lib/Analysis/TargetLibraryInfo.cpp | 2 +- llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp | 2 +- llvm/lib/CodeGen/AsmPrinter/DwarfExpression.h | 2 +- llvm/lib/DebugInfo/Symbolize/DIPrinter.cpp | 2 +- llvm/lib/ExecutionEngine/Orc/IndirectionUtils.cpp | 5 +++-- llvm/lib/LTO/LTOCodeGenerator.cpp | 2 +- llvm/lib/LTO/LTOModule.cpp | 12 ++++++------ llvm/lib/LTO/ThinLTOCodeGenerator.cpp | 2 +- llvm/lib/Linker/LinkModules.cpp | 4 ++-- llvm/lib/MC/MCObjectFileInfo.cpp | 6 +++--- llvm/lib/Support/APInt.cpp | 6 ++---- llvm/lib/Support/CommandLine.cpp | 2 +- llvm/lib/Target/AArch64/AArch64ISelDAGToDAG.cpp | 2 +- llvm/lib/Target/AArch64/Utils/AArch64BaseInfo.h | 4 ++-- llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp | 2 +- llvm/lib/Target/NVPTX/NVPTXAsmPrinter.h | 2 +- llvm/lib/Target/NVPTX/NVPTXMCExpr.cpp | 4 ++-- llvm/lib/Target/NVPTX/NVPTXMCExpr.h | 6 +++--- llvm/lib/Target/NVPTX/NVPTXUtilities.cpp | 4 ++-- llvm/lib/Target/NVPTX/NVPTXUtilities.h | 5 +++-- .../Transforms/InstCombine/InstCombineInternal.h | 4 ++-- .../InstCombine/InstCombineSimplifyDemanded.cpp | 7 +++++-- llvm/lib/Transforms/Scalar/LoopInterchange.cpp | 2 +- llvm/tools/bugpoint/BugDriver.h | 4 ++-- llvm/tools/bugpoint/ExecutionDriver.cpp | 2 +- llvm/tools/dsymutil/DwarfLinker.cpp | 9 +++++---- llvm/tools/llvm-cov/CodeCoverage.cpp | 2 +- llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp | 2 +- llvm/tools/llvm-nm/llvm-nm.cpp | 12 ++++++------ llvm/utils/TableGen/DAGISelMatcherGen.cpp | 4 ++-- llvm/utils/TableGen/DisassemblerEmitter.cpp | 11 +++++------ llvm/utils/TableGen/FixedLenDecoderEmitter.cpp | 10 ++++------ llvm/utils/TableGen/SubtargetEmitter.cpp | 4 ++-- 48 files changed, 108 insertions(+), 108 deletions(-) diff --git a/llvm/include/llvm/ADT/APInt.h b/llvm/include/llvm/ADT/APInt.h index cdb72b95ad71..bde05ff973ef 100644 --- a/llvm/include/llvm/ADT/APInt.h +++ b/llvm/include/llvm/ADT/APInt.h @@ -177,7 +177,7 @@ class APInt { /// provides a more convenient form of divide for internal use since KnuthDiv /// has specific constraints on its inputs. If those constraints are not met /// then it provides a simpler form of divide. - static void divide(const APInt LHS, unsigned lhsWords, const APInt &RHS, + static void divide(const APInt &LHS, unsigned lhsWords, const APInt &RHS, unsigned rhsWords, APInt *Quotient, APInt *Remainder); /// out-of-line slow case for inline constructor diff --git a/llvm/include/llvm/Analysis/ScalarEvolutionExpressions.h b/llvm/include/llvm/Analysis/ScalarEvolutionExpressions.h index 5724a11e6014..bc6fb578f1f9 100644 --- a/llvm/include/llvm/Analysis/ScalarEvolutionExpressions.h +++ b/llvm/include/llvm/Analysis/ScalarEvolutionExpressions.h @@ -335,8 +335,8 @@ namespace llvm { /// where the value is not in the condition, thus computing the /// exit count. If the iteration count can't be computed, an /// instance of SCEVCouldNotCompute is returned. - const SCEV *getNumIterationsInRange(ConstantRange Range, - ScalarEvolution &SE) const; + const SCEV *getNumIterationsInRange(const ConstantRange &Range, + ScalarEvolution &SE) const; /// Return an expression representing the value of this expression /// one iteration of the loop ahead. diff --git a/llvm/include/llvm/Analysis/TargetLibraryInfo.h b/llvm/include/llvm/Analysis/TargetLibraryInfo.h index a28e0fa739d0..afe6d8b03772 100644 --- a/llvm/include/llvm/Analysis/TargetLibraryInfo.h +++ b/llvm/include/llvm/Analysis/TargetLibraryInfo.h @@ -315,7 +315,7 @@ private: StringMap> Impls; - TargetLibraryInfoImpl &lookupInfoImpl(Triple T); + TargetLibraryInfoImpl &lookupInfoImpl(const Triple &T); }; class TargetLibraryInfoWrapperPass : public ImmutablePass { diff --git a/llvm/include/llvm/DebugInfo/Symbolize/DIPrinter.h b/llvm/include/llvm/DebugInfo/Symbolize/DIPrinter.h index 3098199bb4da..49f86eae01cf 100644 --- a/llvm/include/llvm/DebugInfo/Symbolize/DIPrinter.h +++ b/llvm/include/llvm/DebugInfo/Symbolize/DIPrinter.h @@ -31,7 +31,7 @@ class DIPrinter { int PrintSourceContext; void print(const DILineInfo &Info, bool Inlined); - void printContext(std::string FileName, int64_t Line); + void printContext(const std::string &FileName, int64_t Line); public: DIPrinter(raw_ostream &OS, bool PrintFunctionNames = true, diff --git a/llvm/include/llvm/ExecutionEngine/Orc/IndirectionUtils.h b/llvm/include/llvm/ExecutionEngine/Orc/IndirectionUtils.h index fe7a85ba0201..51172c51e136 100644 --- a/llvm/include/llvm/ExecutionEngine/Orc/IndirectionUtils.h +++ b/llvm/include/llvm/ExecutionEngine/Orc/IndirectionUtils.h @@ -334,13 +334,14 @@ private: /// ErrorHandlerAddress will be used by the resulting compile callback /// manager if a compile callback fails. std::unique_ptr -createLocalCompileCallbackManager(Triple T, TargetAddress ErrorHandlerAddress); +createLocalCompileCallbackManager(const Triple &T, + TargetAddress ErrorHandlerAddress); /// @brief Create a local indriect stubs manager builder. /// /// The given target triple will determine the ABI. std::function()> -createLocalIndirectStubsManagerBuilder(Triple T); +createLocalIndirectStubsManagerBuilder(const Triple &T); /// @brief Build a function pointer of FunctionType with the given constant /// address. diff --git a/llvm/include/llvm/LTO/LTOCodeGenerator.h b/llvm/include/llvm/LTO/LTOCodeGenerator.h index e6a9fb1813ff..d083e37d75b8 100644 --- a/llvm/include/llvm/LTO/LTOCodeGenerator.h +++ b/llvm/include/llvm/LTO/LTOCodeGenerator.h @@ -77,7 +77,7 @@ struct LTOCodeGenerator { /// Resets \a HasVerifiedInput. void setModule(std::unique_ptr M); - void setTargetOptions(TargetOptions Options); + void setTargetOptions(const TargetOptions &Options); void setDebugInfo(lto_debug_model); void setCodePICModel(Optional Model) { RelocModel = Model; } diff --git a/llvm/include/llvm/LTO/LTOModule.h b/llvm/include/llvm/LTO/LTOModule.h index 0d89d819c508..2e46219be19e 100644 --- a/llvm/include/llvm/LTO/LTOModule.h +++ b/llvm/include/llvm/LTO/LTOModule.h @@ -91,19 +91,22 @@ public: /// InitializeAllAsmPrinters(); /// InitializeAllAsmParsers(); static ErrorOr> - createFromFile(LLVMContext &Context, const char *path, TargetOptions options); + createFromFile(LLVMContext &Context, const char *path, + const TargetOptions &options); static ErrorOr> createFromOpenFile(LLVMContext &Context, int fd, const char *path, - size_t size, TargetOptions options); + size_t size, const TargetOptions &options); static ErrorOr> createFromOpenFileSlice(LLVMContext &Context, int fd, const char *path, - size_t map_size, off_t offset, TargetOptions options); + size_t map_size, off_t offset, + const TargetOptions &options); static ErrorOr> createFromBuffer(LLVMContext &Context, const void *mem, size_t length, - TargetOptions options, StringRef path = ""); + const TargetOptions &options, StringRef path = ""); static ErrorOr> createInLocalContext(std::unique_ptr Context, const void *mem, - size_t length, TargetOptions options, StringRef path); + size_t length, const TargetOptions &options, + StringRef path); const Module &getModule() const { return const_cast(this)->getModule(); @@ -202,7 +205,7 @@ private: /// Create an LTOModule (private version). static ErrorOr> - makeLTOModule(MemoryBufferRef Buffer, TargetOptions options, + makeLTOModule(MemoryBufferRef Buffer, const TargetOptions &options, LLVMContext &Context, bool ShouldBeLazy); }; } diff --git a/llvm/include/llvm/MC/MCObjectFileInfo.h b/llvm/include/llvm/MC/MCObjectFileInfo.h index 0b1ec32bd1ae..cef4e5b3eb93 100644 --- a/llvm/include/llvm/MC/MCObjectFileInfo.h +++ b/llvm/include/llvm/MC/MCObjectFileInfo.h @@ -356,9 +356,9 @@ private: MCContext *Ctx; Triple TT; - void initMachOMCObjectFileInfo(Triple T); - void initELFMCObjectFileInfo(Triple T); - void initCOFFMCObjectFileInfo(Triple T); + void initMachOMCObjectFileInfo(const Triple &T); + void initELFMCObjectFileInfo(const Triple &T); + void initCOFFMCObjectFileInfo(const Triple &T); public: const Triple &getTargetTriple() const { return TT; } diff --git a/llvm/include/llvm/ProfileData/SampleProf.h b/llvm/include/llvm/ProfileData/SampleProf.h index d731dec1c1cb..9fefefa627b1 100644 --- a/llvm/include/llvm/ProfileData/SampleProf.h +++ b/llvm/include/llvm/ProfileData/SampleProf.h @@ -204,8 +204,8 @@ public: } sampleprof_error addCalledTargetSamples(uint32_t LineOffset, uint32_t Discriminator, - std::string FName, uint64_t Num, - uint64_t Weight = 1) { + const std::string &FName, + uint64_t Num, uint64_t Weight = 1) { return BodySamples[LineLocation(LineOffset, Discriminator)].addCalledTarget( FName, Num, Weight); } diff --git a/llvm/include/llvm/Support/CommandLine.h b/llvm/include/llvm/Support/CommandLine.h index 943d2df37708..432ae2674788 100644 --- a/llvm/include/llvm/Support/CommandLine.h +++ b/llvm/include/llvm/Support/CommandLine.h @@ -946,7 +946,7 @@ public: // getValueName - Overload in subclass to provide a better default value. const char *getValueName() const override { return "string"; } - void printOptionDiff(const Option &O, StringRef V, OptVal Default, + void printOptionDiff(const Option &O, StringRef V, const OptVal &Default, size_t GlobalWidth) const; // An out-of-line virtual method to provide a 'home' for this class. diff --git a/llvm/include/llvm/Support/ScopedPrinter.h b/llvm/include/llvm/Support/ScopedPrinter.h index b9d8a8db1b69..a2f2e0985431 100644 --- a/llvm/include/llvm/Support/ScopedPrinter.h +++ b/llvm/include/llvm/Support/ScopedPrinter.h @@ -190,7 +190,7 @@ public: startLine() << Label << ": " << int(Value) << "\n"; } - void printNumber(StringRef Label, APSInt Value) { + void printNumber(StringRef Label, const APSInt &Value) { startLine() << Label << ": " << Value << "\n"; } diff --git a/llvm/lib/Analysis/DependenceAnalysis.cpp b/llvm/lib/Analysis/DependenceAnalysis.cpp index 3342bdffa39c..796c872f0141 100644 --- a/llvm/lib/Analysis/DependenceAnalysis.cpp +++ b/llvm/lib/Analysis/DependenceAnalysis.cpp @@ -1326,9 +1326,8 @@ bool DependenceInfo::weakCrossingSIVtest( // Computes the GCD of AM and BM. // Also finds a solution to the equation ax - by = gcd(a, b). // Returns true if dependence disproved; i.e., gcd does not divide Delta. -static -bool findGCD(unsigned Bits, APInt AM, APInt BM, APInt Delta, - APInt &G, APInt &X, APInt &Y) { +static bool findGCD(unsigned Bits, const APInt &AM, const APInt &BM, + const APInt &Delta, APInt &G, APInt &X, APInt &Y) { APInt A0(Bits, 1, true), A1(Bits, 0, true); APInt B0(Bits, 0, true), B1(Bits, 1, true); APInt G0 = AM.abs(); @@ -1357,9 +1356,7 @@ bool findGCD(unsigned Bits, APInt AM, APInt BM, APInt Delta, return false; } - -static -APInt floorOfQuotient(APInt A, APInt B) { +static APInt floorOfQuotient(const APInt &A, const APInt &B) { APInt Q = A; // these need to be initialized APInt R = A; APInt::sdivrem(A, B, Q, R); @@ -1372,9 +1369,7 @@ APInt floorOfQuotient(APInt A, APInt B) { return Q - 1; } - -static -APInt ceilingOfQuotient(APInt A, APInt B) { +static APInt ceilingOfQuotient(const APInt &A, const APInt &B) { APInt Q = A; // these need to be initialized APInt R = A; APInt::sdivrem(A, B, Q, R); diff --git a/llvm/lib/Analysis/LazyValueInfo.cpp b/llvm/lib/Analysis/LazyValueInfo.cpp index 041481411a4c..c8568452d5a1 100644 --- a/llvm/lib/Analysis/LazyValueInfo.cpp +++ b/llvm/lib/Analysis/LazyValueInfo.cpp @@ -297,7 +297,7 @@ raw_ostream &operator<<(raw_ostream &OS, const LVILatticeVal &Val) { /// Returns true if this lattice value represents at most one possible value. /// This is as precise as any lattice value can get while still representing /// reachable code. -static bool hasSingleValue(LVILatticeVal Val) { +static bool hasSingleValue(const LVILatticeVal &Val) { if (Val.isConstantRange() && Val.getConstantRange().isSingleElement()) // Integer constants are single element ranges diff --git a/llvm/lib/Analysis/Loads.cpp b/llvm/lib/Analysis/Loads.cpp index a687eccf3e9f..dce243ca6731 100644 --- a/llvm/lib/Analysis/Loads.cpp +++ b/llvm/lib/Analysis/Loads.cpp @@ -25,7 +25,7 @@ using namespace llvm; -static bool isAligned(const Value *Base, APInt Offset, unsigned Align, +static bool isAligned(const Value *Base, const APInt &Offset, unsigned Align, const DataLayout &DL) { APInt BaseAlign(Offset.getBitWidth(), Base->getPointerAlignment(DL)); @@ -52,7 +52,7 @@ static bool isAligned(const Value *Base, unsigned Align, const DataLayout &DL) { /// Test if V is always a pointer to allocated and suitably aligned memory for /// a simple load or store. static bool isDereferenceableAndAlignedPointer( - const Value *V, unsigned Align, APInt Size, const DataLayout &DL, + const Value *V, unsigned Align, const APInt &Size, const DataLayout &DL, const Instruction *CtxI, const DominatorTree *DT, const TargetLibraryInfo *TLI, SmallPtrSetImpl &Visited) { // Note that it is not safe to speculate into a malloc'd region because diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp index b3d98d8ff55a..7a6bc3a76379 100644 --- a/llvm/lib/Analysis/ScalarEvolution.cpp +++ b/llvm/lib/Analysis/ScalarEvolution.cpp @@ -8811,7 +8811,7 @@ ScalarEvolution::howManyGreaterThans(const SCEV *LHS, const SCEV *RHS, return ExitLimit(BECount, MaxBECount, P); } -const SCEV *SCEVAddRecExpr::getNumIterationsInRange(ConstantRange Range, +const SCEV *SCEVAddRecExpr::getNumIterationsInRange(const ConstantRange &Range, ScalarEvolution &SE) const { if (Range.isFullSet()) // Infinite loop. return SE.getCouldNotCompute(); diff --git a/llvm/lib/Analysis/TargetLibraryInfo.cpp b/llvm/lib/Analysis/TargetLibraryInfo.cpp index 925e7ce2d0d8..68b0764c62dc 100644 --- a/llvm/lib/Analysis/TargetLibraryInfo.cpp +++ b/llvm/lib/Analysis/TargetLibraryInfo.cpp @@ -1133,7 +1133,7 @@ TargetLibraryInfo TargetLibraryAnalysis::run(Function &F) { lookupInfoImpl(Triple(F.getParent()->getTargetTriple()))); } -TargetLibraryInfoImpl &TargetLibraryAnalysis::lookupInfoImpl(Triple T) { +TargetLibraryInfoImpl &TargetLibraryAnalysis::lookupInfoImpl(const Triple &T) { std::unique_ptr &Impl = Impls[T.normalize()]; if (!Impl) diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp index d614dfd6fc8b..b66084be8217 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp @@ -178,7 +178,7 @@ void DwarfExpression::AddUnsignedConstant(unsigned Value) { AddStackValue(); } -void DwarfExpression::AddUnsignedConstant(APInt Value) { +void DwarfExpression::AddUnsignedConstant(const APInt &Value) { unsigned Size = Value.getBitWidth(); const uint64_t *Data = Value.getRawData(); diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfExpression.h b/llvm/lib/CodeGen/AsmPrinter/DwarfExpression.h index 318d8d3d7650..e8a8025add98 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfExpression.h +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfExpression.h @@ -100,7 +100,7 @@ public: /// Emit an unsigned constant. void AddUnsignedConstant(unsigned Value); /// Emit an unsigned constant. - void AddUnsignedConstant(APInt Value); + void AddUnsignedConstant(const APInt &Value); /// \brief Emit an entire expression on top of a machine register location. /// diff --git a/llvm/lib/DebugInfo/Symbolize/DIPrinter.cpp b/llvm/lib/DebugInfo/Symbolize/DIPrinter.cpp index 3eb9ffc17f16..be5c603a38ef 100644 --- a/llvm/lib/DebugInfo/Symbolize/DIPrinter.cpp +++ b/llvm/lib/DebugInfo/Symbolize/DIPrinter.cpp @@ -36,7 +36,7 @@ static const char kDILineInfoBadString[] = ""; static const char kBadString[] = "??"; // Prints source code around in the FileName the Line. -void DIPrinter::printContext(std::string FileName, int64_t Line) { +void DIPrinter::printContext(const std::string &FileName, int64_t Line) { if (PrintSourceContext <= 0) return; diff --git a/llvm/lib/ExecutionEngine/Orc/IndirectionUtils.cpp b/llvm/lib/ExecutionEngine/Orc/IndirectionUtils.cpp index 34a0ddf00c85..c7b97865ab7e 100644 --- a/llvm/lib/ExecutionEngine/Orc/IndirectionUtils.cpp +++ b/llvm/lib/ExecutionEngine/Orc/IndirectionUtils.cpp @@ -23,7 +23,8 @@ void JITCompileCallbackManager::anchor() {} void IndirectStubsManager::anchor() {} std::unique_ptr -createLocalCompileCallbackManager(Triple T, TargetAddress ErrorHandlerAddress) { +createLocalCompileCallbackManager(const Triple &T, + TargetAddress ErrorHandlerAddress) { switch (T.getArch()) { default: return nullptr; @@ -45,7 +46,7 @@ createLocalCompileCallbackManager(Triple T, TargetAddress ErrorHandlerAddress) { } std::function()> -createLocalIndirectStubsManagerBuilder(Triple T) { +createLocalIndirectStubsManagerBuilder(const Triple &T) { switch (T.getArch()) { default: return nullptr; diff --git a/llvm/lib/LTO/LTOCodeGenerator.cpp b/llvm/lib/LTO/LTOCodeGenerator.cpp index 0e1c46cff277..526346529323 100644 --- a/llvm/lib/LTO/LTOCodeGenerator.cpp +++ b/llvm/lib/LTO/LTOCodeGenerator.cpp @@ -165,7 +165,7 @@ void LTOCodeGenerator::setModule(std::unique_ptr Mod) { HasVerifiedInput = false; } -void LTOCodeGenerator::setTargetOptions(TargetOptions Options) { +void LTOCodeGenerator::setTargetOptions(const TargetOptions &Options) { this->Options = Options; } diff --git a/llvm/lib/LTO/LTOModule.cpp b/llvm/lib/LTO/LTOModule.cpp index 7e8267798709..fca6ca8011f2 100644 --- a/llvm/lib/LTO/LTOModule.cpp +++ b/llvm/lib/LTO/LTOModule.cpp @@ -108,7 +108,7 @@ std::string LTOModule::getProducerString(MemoryBuffer *Buffer) { ErrorOr> LTOModule::createFromFile(LLVMContext &Context, const char *path, - TargetOptions options) { + const TargetOptions &options) { ErrorOr> BufferOrErr = MemoryBuffer::getFile(path); if (std::error_code EC = BufferOrErr.getError()) { @@ -122,14 +122,14 @@ LTOModule::createFromFile(LLVMContext &Context, const char *path, ErrorOr> LTOModule::createFromOpenFile(LLVMContext &Context, int fd, const char *path, - size_t size, TargetOptions options) { + size_t size, const TargetOptions &options) { return createFromOpenFileSlice(Context, fd, path, size, 0, options); } ErrorOr> LTOModule::createFromOpenFileSlice(LLVMContext &Context, int fd, const char *path, size_t map_size, - off_t offset, TargetOptions options) { + off_t offset, const TargetOptions &options) { ErrorOr> BufferOrErr = MemoryBuffer::getOpenFileSlice(fd, path, map_size, offset); if (std::error_code EC = BufferOrErr.getError()) { @@ -143,7 +143,7 @@ LTOModule::createFromOpenFileSlice(LLVMContext &Context, int fd, ErrorOr> LTOModule::createFromBuffer(LLVMContext &Context, const void *mem, - size_t length, TargetOptions options, + size_t length, const TargetOptions &options, StringRef path) { StringRef Data((const char *)mem, length); MemoryBufferRef Buffer(Data, path); @@ -153,7 +153,7 @@ LTOModule::createFromBuffer(LLVMContext &Context, const void *mem, ErrorOr> LTOModule::createInLocalContext(std::unique_ptr Context, const void *mem, size_t length, - TargetOptions options, StringRef path) { + const TargetOptions &options, StringRef path) { StringRef Data((const char *)mem, length); MemoryBufferRef Buffer(Data, path); // If we own a context, we know this is being used only for symbol extraction, @@ -196,7 +196,7 @@ parseBitcodeFileImpl(MemoryBufferRef Buffer, LLVMContext &Context, } ErrorOr> -LTOModule::makeLTOModule(MemoryBufferRef Buffer, TargetOptions options, +LTOModule::makeLTOModule(MemoryBufferRef Buffer, const TargetOptions &options, LLVMContext &Context, bool ShouldBeLazy) { ErrorOr> MOrErr = parseBitcodeFileImpl(Buffer, Context, ShouldBeLazy); diff --git a/llvm/lib/LTO/ThinLTOCodeGenerator.cpp b/llvm/lib/LTO/ThinLTOCodeGenerator.cpp index 8baab57a7965..4758ef8ba9f9 100644 --- a/llvm/lib/LTO/ThinLTOCodeGenerator.cpp +++ b/llvm/lib/LTO/ThinLTOCodeGenerator.cpp @@ -335,7 +335,7 @@ ProcessThinLTOModule(Module &TheModule, ModuleSummaryIndex &Index, const FunctionImporter::ExportSetTy &ExportList, const DenseSet &GUIDPreservedSymbols, const GVSummaryMapTy &DefinedGlobals, - ThinLTOCodeGenerator::CachingOptions CacheOptions, + const ThinLTOCodeGenerator::CachingOptions &CacheOptions, bool DisableCodeGen, StringRef SaveTempsDir, unsigned count) { diff --git a/llvm/lib/Linker/LinkModules.cpp b/llvm/lib/Linker/LinkModules.cpp index 14a256122599..ff36f90b53f4 100644 --- a/llvm/lib/Linker/LinkModules.cpp +++ b/llvm/lib/Linker/LinkModules.cpp @@ -44,7 +44,7 @@ class ModuleLinker { /// The mover has just hit GV and we have to decide if it, and other members /// of the same comdat, should be linked. Every member to be linked is passed /// to Add. - void addLazyFor(GlobalValue &GV, IRMover::ValueAdder Add); + void addLazyFor(GlobalValue &GV, const IRMover::ValueAdder &Add); bool shouldLinkReferencedLinkOnce() { return !(Flags & Linker::DontForceLinkLinkonceODR); @@ -416,7 +416,7 @@ bool ModuleLinker::linkIfNeeded(GlobalValue &GV) { return false; } -void ModuleLinker::addLazyFor(GlobalValue &GV, IRMover::ValueAdder Add) { +void ModuleLinker::addLazyFor(GlobalValue &GV, const IRMover::ValueAdder &Add) { if (!shouldLinkReferencedLinkOnce()) // For ThinLTO we don't import more than what was required. // The client has to guarantee that the linkonce will be availabe at link diff --git a/llvm/lib/MC/MCObjectFileInfo.cpp b/llvm/lib/MC/MCObjectFileInfo.cpp index 059dcf2477ee..5bbc8d5c5a92 100644 --- a/llvm/lib/MC/MCObjectFileInfo.cpp +++ b/llvm/lib/MC/MCObjectFileInfo.cpp @@ -45,7 +45,7 @@ static bool useCompactUnwind(const Triple &T) { return false; } -void MCObjectFileInfo::initMachOMCObjectFileInfo(Triple T) { +void MCObjectFileInfo::initMachOMCObjectFileInfo(const Triple &T) { // MachO SupportsWeakOmittedEHFrame = false; @@ -283,7 +283,7 @@ void MCObjectFileInfo::initMachOMCObjectFileInfo(Triple T) { TLSExtraDataSection = TLSTLVSection; } -void MCObjectFileInfo::initELFMCObjectFileInfo(Triple T) { +void MCObjectFileInfo::initELFMCObjectFileInfo(const Triple &T) { switch (T.getArch()) { case Triple::mips: case Triple::mipsel: @@ -589,7 +589,7 @@ void MCObjectFileInfo::initELFMCObjectFileInfo(Triple T) { Ctx->getELFSection(".eh_frame", EHSectionType, EHSectionFlags); } -void MCObjectFileInfo::initCOFFMCObjectFileInfo(Triple T) { +void MCObjectFileInfo::initCOFFMCObjectFileInfo(const Triple &T) { EHFrameSection = Ctx->getCOFFSection( ".eh_frame", COFF::IMAGE_SCN_CNT_INITIALIZED_DATA | COFF::IMAGE_SCN_MEM_READ | COFF::IMAGE_SCN_MEM_WRITE, diff --git a/llvm/lib/Support/APInt.cpp b/llvm/lib/Support/APInt.cpp index 8aec54730ca6..cd7b9a9980d5 100644 --- a/llvm/lib/Support/APInt.cpp +++ b/llvm/lib/Support/APInt.cpp @@ -1664,10 +1664,8 @@ static void KnuthDiv(unsigned *u, unsigned *v, unsigned *q, unsigned* r, DEBUG(dbgs() << '\n'); } -void APInt::divide(const APInt LHS, unsigned lhsWords, - const APInt &RHS, unsigned rhsWords, - APInt *Quotient, APInt *Remainder) -{ +void APInt::divide(const APInt &LHS, unsigned lhsWords, const APInt &RHS, + unsigned rhsWords, APInt *Quotient, APInt *Remainder) { assert(lhsWords >= rhsWords && "Fractional result"); // First, compose the values into an array of 32-bit words instead of diff --git a/llvm/lib/Support/CommandLine.cpp b/llvm/lib/Support/CommandLine.cpp index 54756fb85a90..aed42b25e64c 100644 --- a/llvm/lib/Support/CommandLine.cpp +++ b/llvm/lib/Support/CommandLine.cpp @@ -1432,7 +1432,7 @@ PRINT_OPT_DIFF(float) PRINT_OPT_DIFF(char) void parser::printOptionDiff(const Option &O, StringRef V, - OptionValue D, + const OptionValue &D, size_t GlobalWidth) const { printOptionName(O, GlobalWidth); outs() << "= " << V; diff --git a/llvm/lib/Target/AArch64/AArch64ISelDAGToDAG.cpp b/llvm/lib/Target/AArch64/AArch64ISelDAGToDAG.cpp index dfa391916d59..5a11fe66b75e 100644 --- a/llvm/lib/Target/AArch64/AArch64ISelDAGToDAG.cpp +++ b/llvm/lib/Target/AArch64/AArch64ISelDAGToDAG.cpp @@ -1748,7 +1748,7 @@ bool AArch64DAGToDAGISel::tryBitfieldExtractOp(SDNode *N) { /// BitsToBeInserted, suitable for use in a BFI instruction. Roughly speaking, /// this asks whether DstMask zeroes precisely those bits that will be set by /// the other half. -static bool isBitfieldDstMask(uint64_t DstMask, APInt BitsToBeInserted, +static bool isBitfieldDstMask(uint64_t DstMask, const APInt &BitsToBeInserted, unsigned NumberOfIgnoredHighBits, EVT VT) { assert((VT == MVT::i32 || VT == MVT::i64) && "i32 or i64 mask type expected!"); diff --git a/llvm/lib/Target/AArch64/Utils/AArch64BaseInfo.h b/llvm/lib/Target/AArch64/Utils/AArch64BaseInfo.h index 98eaa3880245..f4676e48c0c1 100644 --- a/llvm/lib/Target/AArch64/Utils/AArch64BaseInfo.h +++ b/llvm/lib/Target/AArch64/Utils/AArch64BaseInfo.h @@ -285,8 +285,8 @@ struct AArch64NamedImmMapper { // Zero value of FeatureBitSet means the mapping is always available FeatureBitset FeatureBitSet; - bool isNameEqual(std::string Other, - const FeatureBitset& FeatureBits) const { + bool isNameEqual(const std::string &Other, + const FeatureBitset &FeatureBits) const { if (FeatureBitSet.any() && (FeatureBitSet & FeatureBits).none()) return false; diff --git a/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp b/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp index ec53f0f1b6d6..660016bfcd05 100644 --- a/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp +++ b/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp @@ -2341,7 +2341,7 @@ void NVPTXAsmPrinter::emitSrcInText(StringRef filename, unsigned line) { this->OutStreamer->EmitRawText(temp.str()); } -LineReader *NVPTXAsmPrinter::getReader(std::string filename) { +LineReader *NVPTXAsmPrinter::getReader(const std::string &filename) { if (!reader) { reader = new LineReader(filename); } diff --git a/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.h b/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.h index 9f6a63536493..85660fbdb26e 100644 --- a/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.h +++ b/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.h @@ -293,7 +293,7 @@ private: bool isLoopHeaderOfNoUnroll(const MachineBasicBlock &MBB) const; LineReader *reader; - LineReader *getReader(std::string); + LineReader *getReader(const std::string &); // Used to control the need to emit .generic() in the initializer of // module scope variables. diff --git a/llvm/lib/Target/NVPTX/NVPTXMCExpr.cpp b/llvm/lib/Target/NVPTX/NVPTXMCExpr.cpp index 3c98b9febf85..84d5239ec096 100644 --- a/llvm/lib/Target/NVPTX/NVPTXMCExpr.cpp +++ b/llvm/lib/Target/NVPTX/NVPTXMCExpr.cpp @@ -15,8 +15,8 @@ using namespace llvm; #define DEBUG_TYPE "nvptx-mcexpr" -const NVPTXFloatMCExpr* -NVPTXFloatMCExpr::create(VariantKind Kind, APFloat Flt, MCContext &Ctx) { +const NVPTXFloatMCExpr * +NVPTXFloatMCExpr::create(VariantKind Kind, const APFloat &Flt, MCContext &Ctx) { return new (Ctx) NVPTXFloatMCExpr(Kind, Flt); } diff --git a/llvm/lib/Target/NVPTX/NVPTXMCExpr.h b/llvm/lib/Target/NVPTX/NVPTXMCExpr.h index 7661c10fde40..7f833c42fa8f 100644 --- a/llvm/lib/Target/NVPTX/NVPTXMCExpr.h +++ b/llvm/lib/Target/NVPTX/NVPTXMCExpr.h @@ -37,15 +37,15 @@ public: /// @name Construction /// @{ - static const NVPTXFloatMCExpr *create(VariantKind Kind, APFloat Flt, + static const NVPTXFloatMCExpr *create(VariantKind Kind, const APFloat &Flt, MCContext &Ctx); - static const NVPTXFloatMCExpr *createConstantFPSingle(APFloat Flt, + static const NVPTXFloatMCExpr *createConstantFPSingle(const APFloat &Flt, MCContext &Ctx) { return create(VK_NVPTX_SINGLE_PREC_FLOAT, Flt, Ctx); } - static const NVPTXFloatMCExpr *createConstantFPDouble(APFloat Flt, + static const NVPTXFloatMCExpr *createConstantFPDouble(const APFloat &Flt, MCContext &Ctx) { return create(VK_NVPTX_DOUBLE_PREC_FLOAT, Flt, Ctx); } diff --git a/llvm/lib/Target/NVPTX/NVPTXUtilities.cpp b/llvm/lib/Target/NVPTX/NVPTXUtilities.cpp index 578b466568ae..835e4b442039 100644 --- a/llvm/lib/Target/NVPTX/NVPTXUtilities.cpp +++ b/llvm/lib/Target/NVPTX/NVPTXUtilities.cpp @@ -99,7 +99,7 @@ static void cacheAnnotationFromMD(const Module *m, const GlobalValue *gv) { } } -bool llvm::findOneNVVMAnnotation(const GlobalValue *gv, std::string prop, +bool llvm::findOneNVVMAnnotation(const GlobalValue *gv, const std::string &prop, unsigned &retval) { MutexGuard Guard(Lock); const Module *m = gv->getParent(); @@ -113,7 +113,7 @@ bool llvm::findOneNVVMAnnotation(const GlobalValue *gv, std::string prop, return true; } -bool llvm::findAllNVVMAnnotation(const GlobalValue *gv, std::string prop, +bool llvm::findAllNVVMAnnotation(const GlobalValue *gv, const std::string &prop, std::vector &retval) { MutexGuard Guard(Lock); const Module *m = gv->getParent(); diff --git a/llvm/lib/Target/NVPTX/NVPTXUtilities.h b/llvm/lib/Target/NVPTX/NVPTXUtilities.h index a5262cb7412f..ec5bfc17afc7 100644 --- a/llvm/lib/Target/NVPTX/NVPTXUtilities.h +++ b/llvm/lib/Target/NVPTX/NVPTXUtilities.h @@ -30,8 +30,9 @@ namespace llvm { void clearAnnotationCache(const llvm::Module *); -bool findOneNVVMAnnotation(const llvm::GlobalValue *, std::string, unsigned &); -bool findAllNVVMAnnotation(const llvm::GlobalValue *, std::string, +bool findOneNVVMAnnotation(const llvm::GlobalValue *, const std::string &, + unsigned &); +bool findAllNVVMAnnotation(const llvm::GlobalValue *, const std::string &, std::vector &); bool isTexture(const llvm::Value &); diff --git a/llvm/lib/Transforms/InstCombine/InstCombineInternal.h b/llvm/lib/Transforms/InstCombine/InstCombineInternal.h index 326029d81872..0f1121aef946 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineInternal.h +++ b/llvm/lib/Transforms/InstCombine/InstCombineInternal.h @@ -522,12 +522,12 @@ private: Value *SimplifyDemandedUseBits(Value *V, APInt DemandedMask, APInt &KnownZero, APInt &KnownOne, unsigned Depth, Instruction *CxtI); - bool SimplifyDemandedBits(Use &U, APInt DemandedMask, APInt &KnownZero, + bool SimplifyDemandedBits(Use &U, const APInt &DemandedMask, APInt &KnownZero, APInt &KnownOne, unsigned Depth = 0); /// Helper routine of SimplifyDemandedUseBits. It tries to simplify demanded /// bit for "r1 = shr x, c1; r2 = shl r1, c2" instruction sequence. Value *SimplifyShrShlDemandedBits(Instruction *Lsr, Instruction *Sftl, - APInt DemandedMask, APInt &KnownZero, + const APInt &DemandedMask, APInt &KnownZero, APInt &KnownOne); /// \brief Tries to simplify operands to an integer instruction based on its diff --git a/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp b/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp index adc433c4b707..6d06c0a6a8cf 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp @@ -68,7 +68,7 @@ bool InstCombiner::SimplifyDemandedInstructionBits(Instruction &Inst) { /// SimplifyDemandedBits - This form of SimplifyDemandedBits simplifies the /// specified instruction operand if possible, updating it in place. It returns /// true if it made any change and false otherwise. -bool InstCombiner::SimplifyDemandedBits(Use &U, APInt DemandedMask, +bool InstCombiner::SimplifyDemandedBits(Use &U, const APInt &DemandedMask, APInt &KnownZero, APInt &KnownOne, unsigned Depth) { auto *UserI = dyn_cast(U.getUser()); @@ -830,7 +830,10 @@ Value *InstCombiner::SimplifyDemandedUseBits(Value *V, APInt DemandedMask, /// As with SimplifyDemandedUseBits, it returns NULL if the simplification was /// not successful. Value *InstCombiner::SimplifyShrShlDemandedBits(Instruction *Shr, - Instruction *Shl, APInt DemandedMask, APInt &KnownZero, APInt &KnownOne) { + Instruction *Shl, + const APInt &DemandedMask, + APInt &KnownZero, + APInt &KnownOne) { const APInt &ShlOp1 = cast(Shl->getOperand(1))->getValue(); const APInt &ShrOp1 = cast(Shr->getOperand(1))->getValue(); diff --git a/llvm/lib/Transforms/Scalar/LoopInterchange.cpp b/llvm/lib/Transforms/Scalar/LoopInterchange.cpp index 806c101e4622..05d187f7795b 100644 --- a/llvm/lib/Transforms/Scalar/LoopInterchange.cpp +++ b/llvm/lib/Transforms/Scalar/LoopInterchange.cpp @@ -493,7 +493,7 @@ struct LoopInterchange : public FunctionPass { return true; } - unsigned selectLoopForInterchange(LoopVector LoopList) { + unsigned selectLoopForInterchange(const LoopVector &LoopList) { // TODO: Add a better heuristic to select the loop to be interchanged based // on the dependence matrix. Currently we select the innermost loop. return LoopList.size() - 1; diff --git a/llvm/tools/bugpoint/BugDriver.h b/llvm/tools/bugpoint/BugDriver.h index 20efff3fda5f..56ed8ab712e0 100644 --- a/llvm/tools/bugpoint/BugDriver.h +++ b/llvm/tools/bugpoint/BugDriver.h @@ -76,7 +76,7 @@ public: // command line arguments into instance variables of BugDriver. // bool addSources(const std::vector &FileNames); - void addPass(std::string p) { PassesToRun.push_back(p); } + void addPass(std::string p) { PassesToRun.push_back(std::move(p)); } void setPassesToRun(const std::vector &PTR) { PassesToRun = PTR; } @@ -183,7 +183,7 @@ public: /// Error. /// std::string executeProgramSafely(const Module *Program, - std::string OutputFile, + const std::string &OutputFile, std::string *Error) const; /// createReferenceFile - calls compileProgram and then records the output diff --git a/llvm/tools/bugpoint/ExecutionDriver.cpp b/llvm/tools/bugpoint/ExecutionDriver.cpp index 41b8ccc18e87..ab9c05fa924a 100644 --- a/llvm/tools/bugpoint/ExecutionDriver.cpp +++ b/llvm/tools/bugpoint/ExecutionDriver.cpp @@ -384,7 +384,7 @@ std::string BugDriver::executeProgram(const Module *Program, /// backend, if reference output is not provided. /// std::string BugDriver::executeProgramSafely(const Module *Program, - std::string OutputFile, + const std::string &OutputFile, std::string *Error) const { return executeProgram(Program, OutputFile, "", "", SafeInterpreter, Error); } diff --git a/llvm/tools/dsymutil/DwarfLinker.cpp b/llvm/tools/dsymutil/DwarfLinker.cpp index 3a5718b2b20c..bea30ded591f 100644 --- a/llvm/tools/dsymutil/DwarfLinker.cpp +++ b/llvm/tools/dsymutil/DwarfLinker.cpp @@ -531,7 +531,7 @@ public: /// original \p Entries. void emitRangesEntries( int64_t UnitPcOffset, uint64_t OrigLowPc, - FunctionIntervals::const_iterator FuncRange, + const FunctionIntervals::const_iterator &FuncRange, const std::vector &Entries, unsigned AddressSize); @@ -715,7 +715,7 @@ void DwarfStreamer::emitStrings(const NonRelocatableStringpool &Pool) { /// sized addresses describing the ranges. void DwarfStreamer::emitRangesEntries( int64_t UnitPcOffset, uint64_t OrigLowPc, - FunctionIntervals::const_iterator FuncRange, + const FunctionIntervals::const_iterator &FuncRange, const std::vector &Entries, unsigned AddressSize) { MS->SwitchSection(MC->getObjectFileInfo()->getDwarfRangesSection()); @@ -1416,7 +1416,7 @@ private: /// \defgroup Helpers Various helper methods. /// /// @{ - bool createStreamer(Triple TheTriple, StringRef OutputFilename); + bool createStreamer(const Triple &TheTriple, StringRef OutputFilename); /// \brief Attempt to load a debug object from disk. ErrorOr loadObject(BinaryHolder &BinaryHolder, @@ -1744,7 +1744,8 @@ void DwarfLinker::reportWarning(const Twine &Warning, const DWARFUnit *Unit, 6 /* Indent */); } -bool DwarfLinker::createStreamer(Triple TheTriple, StringRef OutputFilename) { +bool DwarfLinker::createStreamer(const Triple &TheTriple, + StringRef OutputFilename) { if (Options.NoOutput) return true; diff --git a/llvm/tools/llvm-cov/CodeCoverage.cpp b/llvm/tools/llvm-cov/CodeCoverage.cpp index cd786edc25d8..1d40a28e2868 100644 --- a/llvm/tools/llvm-cov/CodeCoverage.cpp +++ b/llvm/tools/llvm-cov/CodeCoverage.cpp @@ -72,7 +72,7 @@ public: int run(Command Cmd, int argc, const char **argv); - typedef std::function CommandLineParserType; + typedef llvm::function_ref CommandLineParserType; int show(int argc, const char **argv, CommandLineParserType commandLineParser); diff --git a/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp b/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp index b0facfb294de..7079ed215c0f 100644 --- a/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp +++ b/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp @@ -114,7 +114,7 @@ static void DumpInput(StringRef Filename) { /// If the input path is a .dSYM bundle (as created by the dsymutil tool), /// replace it with individual entries for each of the object files inside the /// bundle otherwise return the input path. -static std::vector expandBundle(std::string InputPath) { +static std::vector expandBundle(const std::string &InputPath) { std::vector BundlePaths; SmallString<256> BundlePath(InputPath); // Manually open up the bundle to avoid introducing additional dependencies. diff --git a/llvm/tools/llvm-nm/llvm-nm.cpp b/llvm/tools/llvm-nm/llvm-nm.cpp index d838ad870baa..1e4a7eee3733 100644 --- a/llvm/tools/llvm-nm/llvm-nm.cpp +++ b/llvm/tools/llvm-nm/llvm-nm.cpp @@ -597,8 +597,8 @@ static void darwinPrintStab(MachOObjectFile *MachO, SymbolListT::iterator I) { } static void sortAndPrintSymbolList(SymbolicFile &Obj, bool printName, - std::string ArchiveName, - std::string ArchitectureName) { + const std::string &ArchiveName, + const std::string &ArchitectureName) { if (!NoSort) { std::function Cmp; if (NumericSort) @@ -963,10 +963,10 @@ static unsigned getNsectInMachO(MachOObjectFile &Obj, BasicSymbolRef Sym) { return (STE.n_type & MachO::N_TYPE) == MachO::N_SECT ? STE.n_sect : 0; } -static void dumpSymbolNamesFromObject(SymbolicFile &Obj, bool printName, - std::string ArchiveName = std::string(), - std::string ArchitectureName = - std::string()) { +static void +dumpSymbolNamesFromObject(SymbolicFile &Obj, bool printName, + const std::string &ArchiveName = std::string(), + const std::string &ArchitectureName = std::string()) { auto Symbols = Obj.symbols(); if (DynamicSyms) { const auto *E = dyn_cast(&Obj); diff --git a/llvm/utils/TableGen/DAGISelMatcherGen.cpp b/llvm/utils/TableGen/DAGISelMatcherGen.cpp index 04d8ff0b8e6a..4110e9725b5a 100644 --- a/llvm/utils/TableGen/DAGISelMatcherGen.cpp +++ b/llvm/utils/TableGen/DAGISelMatcherGen.cpp @@ -116,7 +116,7 @@ namespace { /// If this is the first time a node with unique identifier Name has been /// seen, record it. Otherwise, emit a check to make sure this is the same /// node. Returns true if this is the first encounter. - bool recordUniqueNode(std::string Name); + bool recordUniqueNode(const std::string &Name); // Result Code Generation. unsigned getNamedArgumentSlot(StringRef Name) { @@ -438,7 +438,7 @@ void MatcherGen::EmitOperatorMatchCode(const TreePatternNode *N, } } -bool MatcherGen::recordUniqueNode(std::string Name) { +bool MatcherGen::recordUniqueNode(const std::string &Name) { unsigned &VarMapEntry = VariableMap[Name]; if (VarMapEntry == 0) { // If it is a named node, we must emit a 'Record' opcode. diff --git a/llvm/utils/TableGen/DisassemblerEmitter.cpp b/llvm/utils/TableGen/DisassemblerEmitter.cpp index b6a2b1c7f5d4..44815b05f274 100644 --- a/llvm/utils/TableGen/DisassemblerEmitter.cpp +++ b/llvm/utils/TableGen/DisassemblerEmitter.cpp @@ -96,12 +96,11 @@ using namespace llvm::X86Disassembler; namespace llvm { extern void EmitFixedLenDecoder(RecordKeeper &RK, raw_ostream &OS, - std::string PredicateNamespace, - std::string GPrefix, - std::string GPostfix, - std::string ROK, - std::string RFail, - std::string L); + const std::string &PredicateNamespace, + const std::string &GPrefix, + const std::string &GPostfix, + const std::string &ROK, + const std::string &RFail, const std::string &L); void EmitDisassembler(RecordKeeper &Records, raw_ostream &OS) { CodeGenTarget Target(Records); diff --git a/llvm/utils/TableGen/FixedLenDecoderEmitter.cpp b/llvm/utils/TableGen/FixedLenDecoderEmitter.cpp index 51f1971258f5..ca6fe501f733 100644 --- a/llvm/utils/TableGen/FixedLenDecoderEmitter.cpp +++ b/llvm/utils/TableGen/FixedLenDecoderEmitter.cpp @@ -2324,12 +2324,10 @@ void FixedLenDecoderEmitter::run(raw_ostream &o) { namespace llvm { void EmitFixedLenDecoder(RecordKeeper &RK, raw_ostream &OS, - std::string PredicateNamespace, - std::string GPrefix, - std::string GPostfix, - std::string ROK, - std::string RFail, - std::string L) { + const std::string &PredicateNamespace, + const std::string &GPrefix, + const std::string &GPostfix, const std::string &ROK, + const std::string &RFail, const std::string &L) { FixedLenDecoderEmitter(RK, PredicateNamespace, GPrefix, GPostfix, ROK, RFail, L).run(OS); } diff --git a/llvm/utils/TableGen/SubtargetEmitter.cpp b/llvm/utils/TableGen/SubtargetEmitter.cpp index c69fcdc25b49..228882177bdf 100644 --- a/llvm/utils/TableGen/SubtargetEmitter.cpp +++ b/llvm/utils/TableGen/SubtargetEmitter.cpp @@ -101,7 +101,7 @@ class SubtargetEmitter { void EmitSchedClassTables(SchedClassTables &SchedTables, raw_ostream &OS); void EmitProcessorModels(raw_ostream &OS); void EmitProcessorLookup(raw_ostream &OS); - void EmitSchedModelHelpers(std::string ClassName, raw_ostream &OS); + void EmitSchedModelHelpers(const std::string &ClassName, raw_ostream &OS); void EmitSchedModel(raw_ostream &OS); void ParseFeaturesFunction(raw_ostream &OS, unsigned NumFeatures, unsigned NumProcs); @@ -1268,7 +1268,7 @@ void SubtargetEmitter::EmitSchedModel(raw_ostream &OS) { OS << "#undef DBGFIELD"; } -void SubtargetEmitter::EmitSchedModelHelpers(std::string ClassName, +void SubtargetEmitter::EmitSchedModelHelpers(const std::string &ClassName, raw_ostream &OS) { OS << "unsigned " << ClassName << "\n::resolveSchedClass(unsigned SchedClass, const MachineInstr *MI,"