From ed2f90902c6adac8d702ce41f29fed6ffd9aa852 Mon Sep 17 00:00:00 2001 From: Anshil Gandhi <95053726+gandhi56@users.noreply.github.com> Date: Tue, 27 Aug 2024 13:28:33 -0400 Subject: [PATCH] [NFC][Attributor] Track the number of promoted indirect calls (#106214) --- llvm/lib/Transforms/IPO/AttributorAttributes.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp index 5469eab6f3dfee..69d29b6c042349 100644 --- a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp +++ b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp @@ -107,6 +107,7 @@ static cl::opt 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. // @@ -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 = @@ -12406,6 +12408,7 @@ struct AAIndirectCallInfoCallSite : public AAIndirectCallInfo { auto *CBClone = cast(CB->clone()); CBClone->insertBefore(ThenTI); NewCall = &cast(promoteCall(*CBClone, NewCallee, &RetBC)); + NumIndirectCallsPromoted++; } else { NewCall = CallInst::Create(FunctionCallee(CSFT, NewCallee), CSArgs, CB->getName(), ThenTI->getIterator());