forked from OSchip/llvm-project
				
			[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
This commit is contained in:
		
							parent
							
								
									740f529dba
								
							
						
					
					
						commit
						ed37df7ea3
					
				| 
						 | 
				
			
			@ -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;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue