Skip to content

[NFC][Attributor] Track the number of promoted indirect calls #106214

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 27, 2024

Conversation

gandhi56
Copy link
Contributor

@gandhi56 gandhi56 commented Aug 27, 2024

No description provided.

Change-Id: I54f1976b414a92c6f6c56125ed4c8870dddd12b6
@llvmbot
Copy link
Member

llvmbot commented Aug 27, 2024

@llvm/pr-subscribers-llvm-transforms

Author: Anshil Gandhi (gandhi56)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/106214.diff

1 Files Affected:

  • (modified) llvm/lib/Transforms/IPO/AttributorAttributes.cpp (+3)
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());

@gandhi56 gandhi56 self-assigned this Aug 27, 2024
@gandhi56 gandhi56 requested a review from shiltian August 27, 2024 12:48
@shiltian
Copy link
Contributor

test?

@gandhi56 gandhi56 changed the title [Attributor] Track the number of promoted indirect calls [NFC][Attributor] Track the number of promoted indirect calls Aug 27, 2024
@gandhi56
Copy link
Contributor Author

test?

Since this is NFC, a test won't be required.

@gandhi56 gandhi56 merged commit ed2f909 into llvm:main Aug 27, 2024
10 checks passed
@gandhi56 gandhi56 deleted the gpu-rdc/indirect-calls-stat branch August 27, 2024 17:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants