[PATCH] D34970: [profiledata] Avoid creating a temporary vector in getNumValueData
Alexander Shaposhnikov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 3 17:34:40 PDT 2017
alexshap created this revision.
getValueSitesForKind returns ArrayRef which has a cast operator to std::vector,
as a result a temporary is created if the type of the variable is const std::vector & .
Test plan: make check-all
Repository:
rL LLVM
https://reviews.llvm.org/D34970
Files:
include/llvm/ProfileData/InstrProf.h
Index: include/llvm/ProfileData/InstrProf.h
===================================================================
--- include/llvm/ProfileData/InstrProf.h
+++ include/llvm/ProfileData/InstrProf.h
@@ -753,7 +753,7 @@
uint32_t InstrProfRecord::getNumValueData(uint32_t ValueKind) const {
uint32_t N = 0;
- const std::vector<InstrProfValueSiteRecord> &SiteRecords =
+ ArrayRef<InstrProfValueSiteRecord> SiteRecords =
getValueSitesForKind(ValueKind);
for (auto &SR : SiteRecords) {
N += SR.ValueData.size();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D34970.105126.patch
Type: text/x-patch
Size: 525 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170704/97752b07/attachment.bin>
More information about the llvm-commits
mailing list