diff options
author | Teresa Johnson <tejohnson@google.com> | 2019-02-05 00:18:38 +0000 |
---|---|---|
committer | Teresa Johnson <tejohnson@google.com> | 2019-02-05 00:18:38 +0000 |
commit | 4bdf82ce7990d10189501ec1a70bb4f16954b5ed (patch) | |
tree | c4c8dea665b8f83e40b8ebae2b82ebcdb2259866 /llvm/lib/Transforms/Instrumentation/IndirectCallPromotion.cpp | |
parent | 81511e5428c4944a185474c7326b25319314a15e (diff) | |
download | bcm5719-llvm-4bdf82ce7990d10189501ec1a70bb4f16954b5ed.tar.gz bcm5719-llvm-4bdf82ce7990d10189501ec1a70bb4f16954b5ed.zip |
[SamplePGO] Minor efficiency improvement in samplePGO ICP
Summary:
When attaching prof metadata to promoted direct calls in SamplePGO
mode, no need to construct and use a SmallVector to pass a single count
to the ArrayRef parameter, we can simply use a brace-enclosed init list.
This made a small but consistent improvement for a ThinLTO backend
compile I was measuring.
Reviewers: wmi
Subscribers: mehdi_amini, dexonsmith, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D57706
llvm-svn: 353123
Diffstat (limited to 'llvm/lib/Transforms/Instrumentation/IndirectCallPromotion.cpp')
-rw-r--r-- | llvm/lib/Transforms/Instrumentation/IndirectCallPromotion.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/Instrumentation/IndirectCallPromotion.cpp b/llvm/lib/Transforms/Instrumentation/IndirectCallPromotion.cpp index ac60aadfbd6..79c219aeed5 100644 --- a/llvm/lib/Transforms/Instrumentation/IndirectCallPromotion.cpp +++ b/llvm/lib/Transforms/Instrumentation/IndirectCallPromotion.cpp @@ -310,10 +310,10 @@ Instruction *llvm::pgo::promoteIndirectCall(Instruction *Inst, promoteCallWithIfThenElse(CallSite(Inst), DirectCallee, BranchWeights); if (AttachProfToDirectCall) { - SmallVector<uint32_t, 1> Weights; - Weights.push_back(Count); MDBuilder MDB(NewInst->getContext()); - NewInst->setMetadata(LLVMContext::MD_prof, MDB.createBranchWeights(Weights)); + NewInst->setMetadata( + LLVMContext::MD_prof, + MDB.createBranchWeights({static_cast<uint32_t>(Count)})); } using namespace ore; |