Skip to content

[Transforms] Migrate to a new version of getValueProfDataFromInst #95477

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

Conversation

kazutakahirata
Copy link
Contributor

Note that the version of getValueProfDataFromInst that returns bool
has been "deprecated" since:

commit 1e15371
Author: Mingming Liu [email protected]
Date: Mon Apr 1 15:14:49 2024 -0700

Note that the version of getValueProfDataFromInst that returns bool
has been "deprecated" since:

  commit 1e15371
  Author: Mingming Liu <[email protected]>
  Date:   Mon Apr 1 15:14:49 2024 -0700
@llvmbot llvmbot added PGO Profile Guided Optimizations llvm:transforms labels Jun 13, 2024
@llvmbot
Copy link
Member

llvmbot commented Jun 13, 2024

@llvm/pr-subscribers-llvm-transforms

@llvm/pr-subscribers-pgo

Author: Kazu Hirata (kazutakahirata)

Changes

Note that the version of getValueProfDataFromInst that returns bool
has been "deprecated" since:

commit 1e15371
Author: Mingming Liu <[email protected]>
Date: Mon Apr 1 15:14:49 2024 -0700


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

1 Files Affected:

  • (modified) llvm/lib/Transforms/Instrumentation/CGProfile.cpp (+5-5)
diff --git a/llvm/lib/Transforms/Instrumentation/CGProfile.cpp b/llvm/lib/Transforms/Instrumentation/CGProfile.cpp
index c322d0abd6bc1..651239bee91f9 100644
--- a/llvm/lib/Transforms/Instrumentation/CGProfile.cpp
+++ b/llvm/lib/Transforms/Instrumentation/CGProfile.cpp
@@ -78,14 +78,14 @@ static bool runCGProfilePass(Module &M, FunctionAnalysisManager &FAM,
         if (!CB)
           continue;
         if (CB->isIndirectCall()) {
-          InstrProfValueData ValueData[8];
           uint32_t ActualNumValueData;
           uint64_t TotalC;
-          if (!getValueProfDataFromInst(*CB, IPVK_IndirectCallTarget, 8,
-                                        ValueData, ActualNumValueData, TotalC))
+          auto ValueData = getValueProfDataFromInst(
+              *CB, IPVK_IndirectCallTarget, 8, ActualNumValueData, TotalC);
+          if (!ValueData)
             continue;
-          for (const auto &VD :
-               ArrayRef<InstrProfValueData>(ValueData, ActualNumValueData)) {
+          for (const auto &VD : ArrayRef<InstrProfValueData>(
+                   ValueData.get(), ActualNumValueData)) {
             UpdateCounts(TTI, &F, Symtab.getFunction(VD.Value), VD.Count);
           }
           continue;

Copy link
Contributor

@mingmingl-llvm mingmingl-llvm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you!

@kazutakahirata kazutakahirata merged commit 602634d into llvm:main Jun 13, 2024
8 of 9 checks passed
@kazutakahirata kazutakahirata deleted the cleanup_getValueProfDataFromInst_CGProfile branch June 13, 2024 23:12
EthanLuisMcDonough pushed a commit to EthanLuisMcDonough/llvm-project that referenced this pull request Aug 13, 2024
…vm#95477)

Note that the version of getValueProfDataFromInst that returns bool
has been "deprecated" since:

  commit 1e15371
  Author: Mingming Liu <[email protected]>
  Date:   Mon Apr 1 15:14:49 2024 -0700
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
llvm:transforms PGO Profile Guided Optimizations
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants