Skip to content

Commit a986064

Browse files
committed
[Attributor][NFC] Add NumCallees argument to callback
1 parent 1577483 commit a986064

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
@@ -3831,7 +3831,7 @@ static bool runAttributorOnFunctions(InformationCache &InfoCache,
38313831
if (MaxSpecializationPerCB.getNumOccurrences()) {
38323832
AC.IndirectCalleeSpecializationCallback =
38333833
[&](Attributor &, const AbstractAttribute &AA, CallBase &CB,
3834-
Function &Callee) {
3834+
Function &Callee, unsigned NumCallees) {
38353835
if (MaxSpecializationPerCB == 0)
38363836
return false;
38373837
auto &Set = IndirectCalleeTrackingMap[&CB];

llvm/lib/Transforms/IPO/AttributorAttributes.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12386,7 +12386,8 @@ struct AAIndirectCallInfoCallSite : public AAIndirectCallInfo {
1238612386
SmallVector<Function *, 8> SkippedAssumedCallees;
1238712387
SmallVector<std::pair<CallInst *, Instruction *>> NewCalls;
1238812388
for (Function *NewCallee : AssumedCallees) {
12389-
if (!A.shouldSpecializeCallSiteForCallee(*this, *CB, *NewCallee)) {
12389+
if (!A.shouldSpecializeCallSiteForCallee(*this, *CB, *NewCallee,
12390+
AssumedCallees.size())) {
1239012391
SkippedAssumedCallees.push_back(NewCallee);
1239112392
SpecializedForAllCallees = false;
1239212393
continue;

0 commit comments

Comments
 (0)