diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2016-11-24 16:01:20 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2016-11-24 16:01:20 +0000 |
commit | 81cb4b71038faef14bb4b2016cb163001387dba7 (patch) | |
tree | e5c4fba1c782552fa6b8e71d6453c637fcaaec7e /clang/lib/CodeGen/CGLoopInfo.cpp | |
parent | 0143bdb8710dac3fb29f521baa81522fa75fdb6f (diff) | |
download | bcm5719-llvm-81cb4b71038faef14bb4b2016cb163001387dba7.tar.gz bcm5719-llvm-81cb4b71038faef14bb4b2016cb163001387dba7.zip |
[CodeGen] Pass objects that are expensive to copy by const ref.
No functionality change. Found by clang-tidy's
performance-unnecessary-value-param.
llvm-svn: 287894
Diffstat (limited to 'clang/lib/CodeGen/CGLoopInfo.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGLoopInfo.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/clang/lib/CodeGen/CGLoopInfo.cpp b/clang/lib/CodeGen/CGLoopInfo.cpp index 7e44c9fc564..28998ce8db4 100644 --- a/clang/lib/CodeGen/CGLoopInfo.cpp +++ b/clang/lib/CodeGen/CGLoopInfo.cpp @@ -20,7 +20,8 @@ using namespace clang::CodeGen; using namespace llvm; static MDNode *createMetadata(LLVMContext &Ctx, const LoopAttributes &Attrs, - llvm::DebugLoc StartLoc, llvm::DebugLoc EndLoc) { + const llvm::DebugLoc &StartLoc, + const llvm::DebugLoc &EndLoc) { if (!Attrs.IsParallel && Attrs.VectorizeWidth == 0 && Attrs.InterleaveCount == 0 && Attrs.UnrollCount == 0 && @@ -121,13 +122,13 @@ void LoopAttributes::clear() { } LoopInfo::LoopInfo(BasicBlock *Header, const LoopAttributes &Attrs, - llvm::DebugLoc StartLoc, llvm::DebugLoc EndLoc) + const llvm::DebugLoc &StartLoc, const llvm::DebugLoc &EndLoc) : LoopID(nullptr), Header(Header), Attrs(Attrs) { LoopID = createMetadata(Header->getContext(), Attrs, StartLoc, EndLoc); } -void LoopInfoStack::push(BasicBlock *Header, llvm::DebugLoc StartLoc, - llvm::DebugLoc EndLoc) { +void LoopInfoStack::push(BasicBlock *Header, const llvm::DebugLoc &StartLoc, + const llvm::DebugLoc &EndLoc) { Active.push_back(LoopInfo(Header, StagedAttrs, StartLoc, EndLoc)); // Clear the attributes so nested loops do not inherit them. StagedAttrs.clear(); @@ -135,7 +136,8 @@ void LoopInfoStack::push(BasicBlock *Header, llvm::DebugLoc StartLoc, void LoopInfoStack::push(BasicBlock *Header, clang::ASTContext &Ctx, ArrayRef<const clang::Attr *> Attrs, - llvm::DebugLoc StartLoc, llvm::DebugLoc EndLoc) { + const llvm::DebugLoc &StartLoc, + const llvm::DebugLoc &EndLoc) { // Identify loop hint attributes from Attrs. for (const auto *Attr : Attrs) { |