Skip to content

Commit 1dc5000

Browse files
[IndirectCallPromotion] Use ArrayRef<PromotionCandidate> (NFC) (#97236)
Aside from the fact that LLVM Programmer's Manual prefers ArrayRef to const std::vector &, ArrayRef<PromotionCandidate> here makes it easier to switch the underlying type to something like SmallVector. Note that we typically do not have a lot of candidates.
1 parent 0a8d5f4 commit 1dc5000

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

llvm/lib/Transforms/Instrumentation/IndirectCallPromotion.cpp

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -359,16 +359,15 @@ class IndirectCallPromoter {
359359
// functions. Return true if there are IR transformations and false
360360
// otherwise.
361361
bool tryToPromoteWithVTableCmp(
362-
CallBase &CB, Instruction *VPtr,
363-
const std::vector<PromotionCandidate> &Candidates,
362+
CallBase &CB, Instruction *VPtr, ArrayRef<PromotionCandidate> Candidates,
364363
uint64_t TotalFuncCount, uint32_t NumCandidates,
365364
MutableArrayRef<InstrProfValueData> ICallProfDataRef,
366365
VTableGUIDCountsMap &VTableGUIDCounts);
367366

368367
// Return true if it's profitable to compare vtables for the callsite.
369-
bool isProfitableToCompareVTables(
370-
const CallBase &CB, const std::vector<PromotionCandidate> &Candidates,
371-
uint64_t TotalCount);
368+
bool isProfitableToCompareVTables(const CallBase &CB,
369+
ArrayRef<PromotionCandidate> Candidates,
370+
uint64_t TotalCount);
372371

373372
// Given an indirect callsite and the list of function candidates, compute
374373
// the following vtable information in output parameters and return vtable
@@ -712,9 +711,8 @@ void IndirectCallPromoter::updateVPtrValueProfiles(
712711
}
713712

714713
bool IndirectCallPromoter::tryToPromoteWithVTableCmp(
715-
CallBase &CB, Instruction *VPtr,
716-
const std::vector<PromotionCandidate> &Candidates, uint64_t TotalFuncCount,
717-
uint32_t NumCandidates,
714+
CallBase &CB, Instruction *VPtr, ArrayRef<PromotionCandidate> Candidates,
715+
uint64_t TotalFuncCount, uint32_t NumCandidates,
718716
MutableArrayRef<InstrProfValueData> ICallProfDataRef,
719717
VTableGUIDCountsMap &VTableGUIDCounts) {
720718
SmallVector<uint64_t, 4> PromotedFuncCount;
@@ -839,7 +837,7 @@ bool IndirectCallPromoter::processFunction(ProfileSummaryInfo *PSI) {
839837
// TODO: Return false if the function addressing and vtable load instructions
840838
// cannot sink to indirect fallback.
841839
bool IndirectCallPromoter::isProfitableToCompareVTables(
842-
const CallBase &CB, const std::vector<PromotionCandidate> &Candidates,
840+
const CallBase &CB, ArrayRef<PromotionCandidate> Candidates,
843841
uint64_t TotalCount) {
844842
if (!EnableVTableProfileUse || Candidates.empty())
845843
return false;

0 commit comments

Comments
 (0)