summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Shaposhnikov <shal1t712@gmail.com>2017-07-05 01:20:52 +0000
committerAlexander Shaposhnikov <shal1t712@gmail.com>2017-07-05 01:20:52 +0000
commited37df7ea3ec2abbface106f888e7c7d27a93261 (patch)
tree2c36c25344d9e7fcdf5c14f523a8e1126ca5ba5e
parent740f529dba1ff5acc1265bb03bd85014566692e6 (diff)
downloadbcm5719-llvm-ed37df7ea3ec2abbface106f888e7c7d27a93261.tar.gz
bcm5719-llvm-ed37df7ea3ec2abbface106f888e7c7d27a93261.zip
[profiledata] Avoid creating a temporary vector in getNumValueData
getValueSitesForKind returns ArrayRef which has a cast operator to std::vector, as a result a temporary vector is created if the type of the variable is const std::vector& that is suboptimal in this case. Differential revision: https://reviews.llvm.org/D34970 Test plan: make check-all llvm-svn: 307113
-rw-r--r--llvm/include/llvm/ProfileData/InstrProf.h5
1 files changed, 1 insertions, 4 deletions
diff --git a/llvm/include/llvm/ProfileData/InstrProf.h b/llvm/include/llvm/ProfileData/InstrProf.h
index a6b2850ccd2..234c2fbeb03 100644
--- a/llvm/include/llvm/ProfileData/InstrProf.h
+++ b/llvm/include/llvm/ProfileData/InstrProf.h
@@ -753,11 +753,8 @@ uint32_t InstrProfRecord::getNumValueKinds() const {
uint32_t InstrProfRecord::getNumValueData(uint32_t ValueKind) const {
uint32_t N = 0;
- const std::vector<InstrProfValueSiteRecord> &SiteRecords =
- getValueSitesForKind(ValueKind);
- for (auto &SR : SiteRecords) {
+ for (auto &SR : getValueSitesForKind(ValueKind))
N += SR.ValueData.size();
- }
return N;
}
OpenPOWER on IntegriCloud