[llvm] [ProfileData] Remove the old version of getValueProfDataFromInst (PR #97374)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 1 19:06:52 PDT 2024
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/97374
I've migrated uses of the old version of getValueProfDataFromInst to
the one that returns SmallVector<InstrProfValueData, 4>. This patch
removes the old version.
>From 896f367f51ec96cd08b9882d8f86f424ea6b9685 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Sun, 23 Jun 2024 11:08:22 -0700
Subject: [PATCH] [ProfileData] Remove the old version of
getValueProfDataFromInst
I've migrated uses of the old version of getValueProfDataFromInst to
the one that returns SmallVector<InstrProfValueData, 4>. This patch
removes the old version.
---
llvm/include/llvm/ProfileData/InstrProf.h | 10 -----
llvm/lib/ProfileData/InstrProf.cpp | 45 -----------------------
2 files changed, 55 deletions(-)
diff --git a/llvm/include/llvm/ProfileData/InstrProf.h b/llvm/include/llvm/ProfileData/InstrProf.h
index 50e6f1d3b9b1f..9b34cb0b651f7 100644
--- a/llvm/include/llvm/ProfileData/InstrProf.h
+++ b/llvm/include/llvm/ProfileData/InstrProf.h
@@ -284,16 +284,6 @@ void annotateValueSite(Module &M, Instruction &Inst,
ArrayRef<InstrProfValueData> VDs, uint64_t Sum,
InstrProfValueKind ValueKind, uint32_t MaxMDCount);
-/// Extract the value profile data from \p Inst and returns them if \p Inst is
-/// annotated with value profile data. Returns nullptr otherwise. It's similar
-/// to `getValueProfDataFromInst` above except that an array is allocated only
-/// after a preliminary checking that the value profiles of kind `ValueKind`
-/// exist.
-std::unique_ptr<InstrProfValueData[]>
-getValueProfDataFromInst(const Instruction &Inst, InstrProfValueKind ValueKind,
- uint32_t MaxNumValueData, uint32_t &ActualNumValueData,
- uint64_t &TotalC, bool GetNoICPValue = false);
-
// TODO: Unify metadata name 'PGOFuncName' and 'PGOName', by supporting read
// of this metadata for backward compatibility and generating 'PGOName' only.
/// Extract the value profile data from \p Inst and returns them if \p Inst is
diff --git a/llvm/lib/ProfileData/InstrProf.cpp b/llvm/lib/ProfileData/InstrProf.cpp
index 9dbaa2ca0f020..4695285787cf3 100644
--- a/llvm/lib/ProfileData/InstrProf.cpp
+++ b/llvm/lib/ProfileData/InstrProf.cpp
@@ -1342,51 +1342,6 @@ MDNode *mayHaveValueProfileOfKind(const Instruction &Inst,
return MD;
}
-static bool getValueProfDataFromInstImpl(const MDNode *const MD,
- const uint32_t MaxNumDataWant,
- InstrProfValueData ValueData[],
- uint32_t &ActualNumValueData,
- uint64_t &TotalC, bool GetNoICPValue) {
- const unsigned NOps = MD->getNumOperands();
- // Get total count
- ConstantInt *TotalCInt = mdconst::dyn_extract<ConstantInt>(MD->getOperand(2));
- if (!TotalCInt)
- return false;
- TotalC = TotalCInt->getZExtValue();
- ActualNumValueData = 0;
-
- for (unsigned I = 3; I < NOps; I += 2) {
- if (ActualNumValueData >= MaxNumDataWant)
- break;
- ConstantInt *Value = mdconst::dyn_extract<ConstantInt>(MD->getOperand(I));
- ConstantInt *Count =
- mdconst::dyn_extract<ConstantInt>(MD->getOperand(I + 1));
- if (!Value || !Count)
- return false;
- uint64_t CntValue = Count->getZExtValue();
- if (!GetNoICPValue && (CntValue == NOMORE_ICP_MAGICNUM))
- continue;
- ValueData[ActualNumValueData].Value = Value->getZExtValue();
- ValueData[ActualNumValueData].Count = CntValue;
- ActualNumValueData++;
- }
- return true;
-}
-
-std::unique_ptr<InstrProfValueData[]>
-getValueProfDataFromInst(const Instruction &Inst, InstrProfValueKind ValueKind,
- uint32_t MaxNumValueData, uint32_t &ActualNumValueData,
- uint64_t &TotalC, bool GetNoICPValue) {
- MDNode *MD = mayHaveValueProfileOfKind(Inst, ValueKind);
- if (!MD)
- return nullptr;
- auto ValueDataArray = std::make_unique<InstrProfValueData[]>(MaxNumValueData);
- if (!getValueProfDataFromInstImpl(MD, MaxNumValueData, ValueDataArray.get(),
- ActualNumValueData, TotalC, GetNoICPValue))
- return nullptr;
- return ValueDataArray;
-}
-
SmallVector<InstrProfValueData, 4>
getValueProfDataFromInst(const Instruction &Inst, InstrProfValueKind ValueKind,
uint32_t MaxNumValueData, uint64_t &TotalC,
More information about the llvm-commits
mailing list