diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2016-06-08 19:09:22 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2016-06-08 19:09:22 +0000 |
commit | c321e534022768d424cf5c5ab43f99489e55bf07 (patch) | |
tree | b8cb4306701534ee6e9ee7ea055dbc25b0c92494 /llvm/lib | |
parent | 19e88c1ff696313db48618d6ced7afcd5253fe35 (diff) | |
download | bcm5719-llvm-c321e534022768d424cf5c5ab43f99489e55bf07.tar.gz bcm5719-llvm-c321e534022768d424cf5c5ab43f99489e55bf07.zip |
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
Diffstat (limited to 'llvm/lib')
27 files changed, 54 insertions, 56 deletions
diff --git a/llvm/lib/Analysis/DependenceAnalysis.cpp b/llvm/lib/Analysis/DependenceAnalysis.cpp index 3342bdffa39..796c872f014 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 041481411a4..c8568452d5a 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 a687eccf3e9..dce243ca673 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<const Value *> &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 b3d98d8ff55..7a6bc3a7637 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 925e7ce2d0d..68b0764c62d 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<TargetLibraryInfoImpl> &Impl = Impls[T.normalize()]; if (!Impl) diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp index d614dfd6fc8..b66084be821 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 318d8d3d765..e8a8025add9 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 3eb9ffc17f1..be5c603a38e 100644 --- a/llvm/lib/DebugInfo/Symbolize/DIPrinter.cpp +++ b/llvm/lib/DebugInfo/Symbolize/DIPrinter.cpp @@ -36,7 +36,7 @@ static const char kDILineInfoBadString[] = "<invalid>"; 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 34a0ddf00c8..c7b97865ab7 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<JITCompileCallbackManager> -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<std::unique_ptr<IndirectStubsManager>()> -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 0e1c46cff27..52634652932 100644 --- a/llvm/lib/LTO/LTOCodeGenerator.cpp +++ b/llvm/lib/LTO/LTOCodeGenerator.cpp @@ -165,7 +165,7 @@ void LTOCodeGenerator::setModule(std::unique_ptr<LTOModule> 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 7e826779870..fca6ca8011f 100644 --- a/llvm/lib/LTO/LTOModule.cpp +++ b/llvm/lib/LTO/LTOModule.cpp @@ -108,7 +108,7 @@ std::string LTOModule::getProducerString(MemoryBuffer *Buffer) { ErrorOr<std::unique_ptr<LTOModule>> LTOModule::createFromFile(LLVMContext &Context, const char *path, - TargetOptions options) { + const TargetOptions &options) { ErrorOr<std::unique_ptr<MemoryBuffer>> BufferOrErr = MemoryBuffer::getFile(path); if (std::error_code EC = BufferOrErr.getError()) { @@ -122,14 +122,14 @@ LTOModule::createFromFile(LLVMContext &Context, const char *path, ErrorOr<std::unique_ptr<LTOModule>> 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<std::unique_ptr<LTOModule>> 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<std::unique_ptr<MemoryBuffer>> 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<std::unique_ptr<LTOModule>> 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<std::unique_ptr<LTOModule>> LTOModule::createInLocalContext(std::unique_ptr<LLVMContext> 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<std::unique_ptr<LTOModule>> -LTOModule::makeLTOModule(MemoryBufferRef Buffer, TargetOptions options, +LTOModule::makeLTOModule(MemoryBufferRef Buffer, const TargetOptions &options, LLVMContext &Context, bool ShouldBeLazy) { ErrorOr<std::unique_ptr<Module>> MOrErr = parseBitcodeFileImpl(Buffer, Context, ShouldBeLazy); diff --git a/llvm/lib/LTO/ThinLTOCodeGenerator.cpp b/llvm/lib/LTO/ThinLTOCodeGenerator.cpp index 8baab57a796..4758ef8ba9f 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<GlobalValue::GUID> &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 14a25612259..ff36f90b53f 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 059dcf2477e..5bbc8d5c5a9 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 8aec54730ca..cd7b9a9980d 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 54756fb85a9..aed42b25e64 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<std::string>::printOptionDiff(const Option &O, StringRef V, - OptionValue<std::string> D, + const OptionValue<std::string> &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 dfa391916d5..5a11fe66b75 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 98eaa388024..f4676e48c0c 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 ec53f0f1b6d..660016bfcd0 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 9f6a6353649..85660fbdb26 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 3c98b9febf8..84d5239ec09 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 7661c10fde4..7f833c42fa8 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 578b466568a..835e4b44203 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<unsigned> &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 a5262cb7412..ec5bfc17afc 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<unsigned> &); bool isTexture(const llvm::Value &); diff --git a/llvm/lib/Transforms/InstCombine/InstCombineInternal.h b/llvm/lib/Transforms/InstCombine/InstCombineInternal.h index 326029d8187..0f1121aef94 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 adc433c4b70..6d06c0a6a8c 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<Instruction>(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<ConstantInt>(Shl->getOperand(1))->getValue(); const APInt &ShrOp1 = cast<ConstantInt>(Shr->getOperand(1))->getValue(); diff --git a/llvm/lib/Transforms/Scalar/LoopInterchange.cpp b/llvm/lib/Transforms/Scalar/LoopInterchange.cpp index 806c101e462..05d187f7795 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; |