Skip to content

Commit 606b50e

Browse files
jdoerfertshiltian
authored andcommitted
[Attributor][NFC] Add NumCallees argument to callback
1 parent 2e57e63 commit 606b50e

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
@@ -1718,10 +1718,11 @@ struct Attributor {
17181718
/// Return true if we should specialize the call site \b CB for the potential
17191719
/// callee \p Fn.
17201720
bool shouldSpecializeCallSiteForCallee(const AbstractAttribute &AA,
1721-
CallBase &CB, Function &Callee) {
1721+
CallBase &CB, Function &Callee,
1722+
unsigned NumCallees) {
17221723
return Configuration.IndirectCalleeSpecializationCallback
1723-
? Configuration.IndirectCalleeSpecializationCallback(*this, AA,
1724-
CB, Callee)
1724+
? Configuration.IndirectCalleeSpecializationCallback(
1725+
*this, AA, CB, Callee, NumCallees)
17251726
: true;
17261727
}
17271728

llvm/lib/Transforms/IPO/Attributor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3836,7 +3836,7 @@ static bool runAttributorOnFunctions(InformationCache &InfoCache,
38363836
if (MaxSpecializationPerCB.getNumOccurrences()) {
38373837
AC.IndirectCalleeSpecializationCallback =
38383838
[&](Attributor &, const AbstractAttribute &AA, CallBase &CB,
3839-
Function &Callee) {
3839+
Function &Callee, unsigned NumCallees) {
38403840
if (MaxSpecializationPerCB == 0)
38413841
return false;
38423842
auto &Set = IndirectCalleeTrackingMap[&CB];

llvm/lib/Transforms/IPO/AttributorAttributes.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12347,7 +12347,8 @@ struct AAIndirectCallInfoCallSite : public AAIndirectCallInfo {
1234712347
SmallVector<Function *, 8> SkippedAssumedCallees;
1234812348
SmallVector<std::pair<CallInst *, Instruction *>> NewCalls;
1234912349
for (Function *NewCallee : AssumedCallees) {
12350-
if (!A.shouldSpecializeCallSiteForCallee(*this, *CB, *NewCallee)) {
12350+
if (!A.shouldSpecializeCallSiteForCallee(*this, *CB, *NewCallee,
12351+
AssumedCallees.size())) {
1235112352
SkippedAssumedCallees.push_back(NewCallee);
1235212353
SpecializedForAllCallees = false;
1235312354
continue;

0 commit comments

Comments
 (0)