[llvm] [Attributor] Track the number of promoted indirect calls (PR #106214)
Anshil Gandhi via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 27 05:47:53 PDT 2024
https://github.com/gandhi56 created https://github.com/llvm/llvm-project/pull/106214
Change-Id: I54f1976b414a92c6f6c56125ed4c8870dddd12b6
>From 590ce2ffd5bdce10cab9427cf4b1413ffc904f55 Mon Sep 17 00:00:00 2001
From: Anshil Gandhi <Anshil.Gandhi at amd.com>
Date: Tue, 27 Aug 2024 12:46:44 +0000
Subject: [PATCH] [Attributor] Track the number of promoted indirect calls
Change-Id: I54f1976b414a92c6f6c56125ed4c8870dddd12b6
---
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<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.
//
@@ -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<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());
More information about the llvm-commits
mailing list