@@ -547,18 +547,17 @@ Instruction *IndirectCallPromoter::computeVTableInfos(
547
547
for (size_t I = 0 ; I < Candidates.size (); I++)
548
548
CalleeIndexMap[Candidates[I].TargetFunction ] = I;
549
549
550
- uint32_t ActualNumValueData = 0 ;
551
550
uint64_t TotalVTableCount = 0 ;
552
- auto VTableValueDataArray = getValueProfDataFromInst (
553
- *VirtualCallInfo.VPtr , IPVK_VTableTarget, MaxNumVTableAnnotations ,
554
- ActualNumValueData , TotalVTableCount);
555
- if (VTableValueDataArray.get () == nullptr )
551
+ auto VTableValueDataArray =
552
+ getValueProfDataFromInst ( *VirtualCallInfo.VPtr , IPVK_VTableTarget,
553
+ MaxNumVTableAnnotations , TotalVTableCount);
554
+ if (VTableValueDataArray.empty () )
556
555
return VPtr;
557
556
558
557
// Compute the functions and counts from by each vtable.
559
- for (size_t j = 0 ; j < ActualNumValueData; j++ ) {
560
- uint64_t VTableVal = VTableValueDataArray[j] .Value ;
561
- GUIDCountsMap[VTableVal] = VTableValueDataArray[j] .Count ;
558
+ for (const auto &V : VTableValueDataArray ) {
559
+ uint64_t VTableVal = V .Value ;
560
+ GUIDCountsMap[VTableVal] = V .Count ;
562
561
GlobalVariable *VTableVar = Symtab->getGlobalVariable (VTableVal);
563
562
if (!VTableVar) {
564
563
LLVM_DEBUG (dbgs () << " Cannot find vtable definition for " << VTableVal
@@ -586,7 +585,7 @@ Instruction *IndirectCallPromoter::computeVTableInfos(
586
585
// There shouldn't be duplicate GUIDs in one !prof metadata (except
587
586
// duplicated zeros), so assign counters directly won't cause overwrite or
588
587
// counter loss.
589
- Candidate.VTableGUIDAndCounts [VTableVal] = VTableValueDataArray[j] .Count ;
588
+ Candidate.VTableGUIDAndCounts [VTableVal] = V .Count ;
590
589
Candidate.AddressPoints .push_back (
591
590
getOrCreateVTableAddressPointVar (VTableVar, AddressPointOffset));
592
591
}
0 commit comments