Skip to content

Commit b8eaa5b

Browse files
[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.
1 parent 072e81d commit b8eaa5b

File tree

2 files changed

+0
-55
lines changed

2 files changed

+0
-55
lines changed

llvm/include/llvm/ProfileData/InstrProf.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -284,16 +284,6 @@ void annotateValueSite(Module &M, Instruction &Inst,
284284
ArrayRef<InstrProfValueData> VDs, uint64_t Sum,
285285
InstrProfValueKind ValueKind, uint32_t MaxMDCount);
286286

287-
/// Extract the value profile data from \p Inst and returns them if \p Inst is
288-
/// annotated with value profile data. Returns nullptr otherwise. It's similar
289-
/// to `getValueProfDataFromInst` above except that an array is allocated only
290-
/// after a preliminary checking that the value profiles of kind `ValueKind`
291-
/// exist.
292-
std::unique_ptr<InstrProfValueData[]>
293-
getValueProfDataFromInst(const Instruction &Inst, InstrProfValueKind ValueKind,
294-
uint32_t MaxNumValueData, uint32_t &ActualNumValueData,
295-
uint64_t &TotalC, bool GetNoICPValue = false);
296-
297287
// TODO: Unify metadata name 'PGOFuncName' and 'PGOName', by supporting read
298288
// of this metadata for backward compatibility and generating 'PGOName' only.
299289
/// Extract the value profile data from \p Inst and returns them if \p Inst is

llvm/lib/ProfileData/InstrProf.cpp

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1342,51 +1342,6 @@ MDNode *mayHaveValueProfileOfKind(const Instruction &Inst,
13421342
return MD;
13431343
}
13441344

1345-
static bool getValueProfDataFromInstImpl(const MDNode *const MD,
1346-
const uint32_t MaxNumDataWant,
1347-
InstrProfValueData ValueData[],
1348-
uint32_t &ActualNumValueData,
1349-
uint64_t &TotalC, bool GetNoICPValue) {
1350-
const unsigned NOps = MD->getNumOperands();
1351-
// Get total count
1352-
ConstantInt *TotalCInt = mdconst::dyn_extract<ConstantInt>(MD->getOperand(2));
1353-
if (!TotalCInt)
1354-
return false;
1355-
TotalC = TotalCInt->getZExtValue();
1356-
ActualNumValueData = 0;
1357-
1358-
for (unsigned I = 3; I < NOps; I += 2) {
1359-
if (ActualNumValueData >= MaxNumDataWant)
1360-
break;
1361-
ConstantInt *Value = mdconst::dyn_extract<ConstantInt>(MD->getOperand(I));
1362-
ConstantInt *Count =
1363-
mdconst::dyn_extract<ConstantInt>(MD->getOperand(I + 1));
1364-
if (!Value || !Count)
1365-
return false;
1366-
uint64_t CntValue = Count->getZExtValue();
1367-
if (!GetNoICPValue && (CntValue == NOMORE_ICP_MAGICNUM))
1368-
continue;
1369-
ValueData[ActualNumValueData].Value = Value->getZExtValue();
1370-
ValueData[ActualNumValueData].Count = CntValue;
1371-
ActualNumValueData++;
1372-
}
1373-
return true;
1374-
}
1375-
1376-
std::unique_ptr<InstrProfValueData[]>
1377-
getValueProfDataFromInst(const Instruction &Inst, InstrProfValueKind ValueKind,
1378-
uint32_t MaxNumValueData, uint32_t &ActualNumValueData,
1379-
uint64_t &TotalC, bool GetNoICPValue) {
1380-
MDNode *MD = mayHaveValueProfileOfKind(Inst, ValueKind);
1381-
if (!MD)
1382-
return nullptr;
1383-
auto ValueDataArray = std::make_unique<InstrProfValueData[]>(MaxNumValueData);
1384-
if (!getValueProfDataFromInstImpl(MD, MaxNumValueData, ValueDataArray.get(),
1385-
ActualNumValueData, TotalC, GetNoICPValue))
1386-
return nullptr;
1387-
return ValueDataArray;
1388-
}
1389-
13901345
SmallVector<InstrProfValueData, 4>
13911346
getValueProfDataFromInst(const Instruction &Inst, InstrProfValueKind ValueKind,
13921347
uint32_t MaxNumValueData, uint64_t &TotalC,

0 commit comments

Comments
 (0)