aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKazu Hirata <kazu@google.com>2024-07-02 11:46:31 -0700
committerGitHub <noreply@github.com>2024-07-02 11:46:31 -0700
commitb8eaa5bb10e1cf282fef130e372e57acc6a4b7e7 (patch)
tree53e9a6161f4a7cd532321faaad091f24fcc9ab16
parent072e81db7a974bfb27b9b65d73330de7dd739821 (diff)
downloadllvm-b8eaa5bb10e1cf282fef130e372e57acc6a4b7e7.zip
llvm-b8eaa5bb10e1cf282fef130e372e57acc6a4b7e7.tar.gz
llvm-b8eaa5bb10e1cf282fef130e372e57acc6a4b7e7.tar.bz2
[ProfileData] Remove the old version of getValueProfDataFromInst (#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.
-rw-r--r--llvm/include/llvm/ProfileData/InstrProf.h10
-rw-r--r--llvm/lib/ProfileData/InstrProf.cpp45
2 files changed, 0 insertions, 55 deletions
diff --git a/llvm/include/llvm/ProfileData/InstrProf.h b/llvm/include/llvm/ProfileData/InstrProf.h
index 50e6f1d..9b34cb0 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 9dbaa2c..4695285 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,