[llvm] [IndirectCallPromotion] Use ArrayRef consistently (NFC) (PR #96412)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Sat Jun 22 17:36:25 PDT 2024
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/96412
getPromotionCandidatesForCallSite uses const
ArrayRef<InstrProfValueData> &, while tryToPromoteWithFuncCmp uses
std::vector<PromotionCandidate> &. This patch switches to ArrayRef
per LLVM Programmer’s Manual.
>From 2d787c9a6f186ecc4daaf43995f844fe28927973 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Sat, 22 Jun 2024 16:48:13 -0700
Subject: [PATCH] [IndirectCallPromotion] Use ArrayRef consistently (NFC)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
getPromotionCandidatesForCallSite uses const
ArrayRef<InstrProfValueData> &, while tryToPromoteWithFuncCmp uses
std::vector<PromotionCandidate> &. This patch switches to ArrayRef
per LLVM Programmer’s Manual.
---
.../Instrumentation/IndirectCallPromotion.cpp | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/llvm/lib/Transforms/Instrumentation/IndirectCallPromotion.cpp b/llvm/lib/Transforms/Instrumentation/IndirectCallPromotion.cpp
index bb8019b5c31d8..fe9eaae9ac7ea 100644
--- a/llvm/lib/Transforms/Instrumentation/IndirectCallPromotion.cpp
+++ b/llvm/lib/Transforms/Instrumentation/IndirectCallPromotion.cpp
@@ -133,16 +133,17 @@ class IndirectCallPromoter {
// TotalCount is the total profiled count of call executions, and
// NumCandidates is the number of candidate entries in ValueDataRef.
std::vector<PromotionCandidate> getPromotionCandidatesForCallSite(
- const CallBase &CB, const ArrayRef<InstrProfValueData> &ValueDataRef,
+ const CallBase &CB, ArrayRef<InstrProfValueData> ValueDataRef,
uint64_t TotalCount, uint32_t NumCandidates);
// Promote a list of targets for one indirect-call callsite by comparing
// indirect callee with functions. Returns true if there are IR
// transformations and false otherwise.
- bool tryToPromoteWithFuncCmp(
- CallBase &CB, const std::vector<PromotionCandidate> &Candidates,
- uint64_t TotalCount, ArrayRef<InstrProfValueData> ICallProfDataRef,
- uint32_t NumCandidates);
+ bool tryToPromoteWithFuncCmp(CallBase &CB,
+ ArrayRef<PromotionCandidate> Candidates,
+ uint64_t TotalCount,
+ ArrayRef<InstrProfValueData> ICallProfDataRef,
+ uint32_t NumCandidates);
public:
IndirectCallPromoter(Function &Func, InstrProfSymtab *Symtab, bool SamplePGO,
@@ -160,7 +161,7 @@ class IndirectCallPromoter {
// the count. Stop at the first target that is not promoted.
std::vector<IndirectCallPromoter::PromotionCandidate>
IndirectCallPromoter::getPromotionCandidatesForCallSite(
- const CallBase &CB, const ArrayRef<InstrProfValueData> &ValueDataRef,
+ const CallBase &CB, ArrayRef<InstrProfValueData> ValueDataRef,
uint64_t TotalCount, uint32_t NumCandidates) {
std::vector<PromotionCandidate> Ret;
@@ -277,9 +278,8 @@ CallBase &llvm::pgo::promoteIndirectCall(CallBase &CB, Function *DirectCallee,
// Promote indirect-call to conditional direct-call for one callsite.
bool IndirectCallPromoter::tryToPromoteWithFuncCmp(
- CallBase &CB, const std::vector<PromotionCandidate> &Candidates,
- uint64_t TotalCount, ArrayRef<InstrProfValueData> ICallProfDataRef,
- uint32_t NumCandidates) {
+ CallBase &CB, ArrayRef<PromotionCandidate> Candidates, uint64_t TotalCount,
+ ArrayRef<InstrProfValueData> ICallProfDataRef, uint32_t NumCandidates) {
uint32_t NumPromoted = 0;
for (const auto &C : Candidates) {
More information about the llvm-commits
mailing list