Skip to content

Commit a475301

Browse files
committed
[Attributor][NFC] Add NumCallees argument to callback
1 parent 38b4df5 commit a475301

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

llvm/include/llvm/Transforms/IPO/Attributor.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1717,10 +1717,11 @@ struct Attributor {
17171717
/// Return true if we should specialize the call site \b CB for the potential
17181718
/// callee \p Fn.
17191719
bool shouldSpecializeCallSiteForCallee(const AbstractAttribute &AA,
1720-
CallBase &CB, Function &Callee) {
1720+
CallBase &CB, Function &Callee,
1721+
unsigned NumCallees) {
17211722
return Configuration.IndirectCalleeSpecializationCallback
1722-
? Configuration.IndirectCalleeSpecializationCallback(*this, AA,
1723-
CB, Callee)
1723+
? Configuration.IndirectCalleeSpecializationCallback(
1724+
*this, AA, CB, Callee, NumCallees)
17241725
: true;
17251726
}
17261727

llvm/lib/Transforms/IPO/Attributor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3821,7 +3821,7 @@ static bool runAttributorOnFunctions(InformationCache &InfoCache,
38213821
if (MaxSpecializationPerCB.getNumOccurrences()) {
38223822
AC.IndirectCalleeSpecializationCallback =
38233823
[&](Attributor &, const AbstractAttribute &AA, CallBase &CB,
3824-
Function &Callee) {
3824+
Function &Callee, unsigned NumCallees) {
38253825
if (MaxSpecializationPerCB == 0)
38263826
return false;
38273827
auto &Set = IndirectCalleeTrackingMap[&CB];

llvm/lib/Transforms/IPO/AttributorAttributes.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12352,7 +12352,8 @@ struct AAIndirectCallInfoCallSite : public AAIndirectCallInfo {
1235212352
SmallVector<Function *, 8> SkippedAssumedCallees;
1235312353
SmallVector<std::pair<CallInst *, Instruction *>> NewCalls;
1235412354
for (Function *NewCallee : AssumedCallees) {
12355-
if (!A.shouldSpecializeCallSiteForCallee(*this, *CB, *NewCallee)) {
12355+
if (!A.shouldSpecializeCallSiteForCallee(*this, *CB, *NewCallee,
12356+
AssumedCallees.size())) {
1235612357
SkippedAssumedCallees.push_back(NewCallee);
1235712358
SpecializedForAllCallees = false;
1235812359
continue;

0 commit comments

Comments
 (0)