[llvm] [Analysis] Migrate to a new version of getValueProfDataFromInst (PR #95561)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 14 09:16:09 PDT 2024


https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/95561

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

>From 9cec943b38d46e32497f93b61acf69c88d608dd6 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Fri, 14 Jun 2024 09:10:11 -0700
Subject: [PATCH] [Analysis] Migrate to a new version of
 getValueProfDataFromInst

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
---
 llvm/lib/Analysis/IndirectCallPromotionAnalysis.cpp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/llvm/lib/Analysis/IndirectCallPromotionAnalysis.cpp b/llvm/lib/Analysis/IndirectCallPromotionAnalysis.cpp
index ab53717eb889a..84b0a1b2a5387 100644
--- a/llvm/lib/Analysis/IndirectCallPromotionAnalysis.cpp
+++ b/llvm/lib/Analysis/IndirectCallPromotionAnalysis.cpp
@@ -91,13 +91,13 @@ ArrayRef<InstrProfValueData>
 ICallPromotionAnalysis::getPromotionCandidatesForInstruction(
     const Instruction *I, uint32_t &NumVals, uint64_t &TotalCount,
     uint32_t &NumCandidates) {
-  bool Res =
-      getValueProfDataFromInst(*I, IPVK_IndirectCallTarget, MaxNumPromotions,
-                               ValueDataArray.get(), NumVals, TotalCount);
+  auto Res = getValueProfDataFromInst(*I, IPVK_IndirectCallTarget,
+                                      MaxNumPromotions, NumVals, TotalCount);
   if (!Res) {
     NumCandidates = 0;
     return ArrayRef<InstrProfValueData>();
   }
+  ValueDataArray = std::move(Res);
   NumCandidates = getProfitablePromotionCandidates(I, NumVals, TotalCount);
   return ArrayRef<InstrProfValueData>(ValueDataArray.get(), NumVals);
 }



More information about the llvm-commits mailing list