[llvm] 602634d - [Transforms] Migrate to a new version of getValueProfDataFromInst (#95477)

via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 13 16:12:55 PDT 2024


Author: Kazu Hirata
Date: 2024-06-13T16:12:51-07:00
New Revision: 602634d70cba2c51f6177740c4a98a377d10ab6a

URL: https://github.com/llvm/llvm-project/commit/602634d70cba2c51f6177740c4a98a377d10ab6a
DIFF: https://github.com/llvm/llvm-project/commit/602634d70cba2c51f6177740c4a98a377d10ab6a.diff

LOG: [Transforms] Migrate to a new version of getValueProfDataFromInst (#95477)

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

  commit 1e15371dd8843dfc52b9435afaa133997c1773d8
  Author: Mingming Liu <mingmingl at google.com>
  Date:   Mon Apr 1 15:14:49 2024 -0700

Added: 
    

Modified: 
    llvm/lib/Transforms/Instrumentation/CGProfile.cpp

Removed: 
    


################################################################################
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;


        


More information about the llvm-commits mailing list