[llvm] b8eaa5b - [ProfileData] Remove the old version of getValueProfDataFromInst (#97374)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 2 11:46:35 PDT 2024
Author: Kazu Hirata
Date: 2024-07-02T11:46:31-07:00
New Revision: b8eaa5bb10e1cf282fef130e372e57acc6a4b7e7
URL: https://github.com/llvm/llvm-project/commit/b8eaa5bb10e1cf282fef130e372e57acc6a4b7e7
DIFF: https://github.com/llvm/llvm-project/commit/b8eaa5bb10e1cf282fef130e372e57acc6a4b7e7.diff
LOG: [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.
Added:
Modified:
llvm/include/llvm/ProfileData/InstrProf.h
llvm/lib/ProfileData/InstrProf.cpp
Removed:
################################################################################
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