Skip to content

Commit

Permalink
[NFC][Attributor] Track the number of promoted indirect calls (#106214)
Browse files Browse the repository at this point in the history
  • Loading branch information
gandhi56 authored Aug 27, 2024
1 parent 4dda564 commit ed2f909
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions llvm/lib/Transforms/IPO/AttributorAttributes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ static cl::opt<int> MaxPotentialValuesIterations(
cl::init(64));

STATISTIC(NumAAs, "Number of abstract attributes created");
STATISTIC(NumIndirectCallsPromoted, "Number of indirect calls promoted");

// Some helper macros to deal with statistics tracking.
//
Expand Down Expand Up @@ -12350,6 +12351,7 @@ struct AAIndirectCallInfoCallSite : public AAIndirectCallInfo {
auto *NewCallee = AssumedCallees.front();
if (isLegalToPromote(*CB, NewCallee)) {
promoteCall(*CB, NewCallee, nullptr);
NumIndirectCallsPromoted++;
return ChangeStatus::CHANGED;
}
Instruction *NewCall =
Expand Down Expand Up @@ -12406,6 +12408,7 @@ struct AAIndirectCallInfoCallSite : public AAIndirectCallInfo {
auto *CBClone = cast<CallBase>(CB->clone());
CBClone->insertBefore(ThenTI);
NewCall = &cast<CallInst>(promoteCall(*CBClone, NewCallee, &RetBC));
NumIndirectCallsPromoted++;
} else {
NewCall = CallInst::Create(FunctionCallee(CSFT, NewCallee), CSArgs,
CB->getName(), ThenTI->getIterator());
Expand Down

0 comments on commit ed2f909

Please sign in to comment.