[llvm] [ProfileData] Clean up validateRecord (PR #95488)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 13 22:40:17 PDT 2024
================
@@ -1035,16 +1035,13 @@ static const char *ValueProfKindStr[] = {
Error InstrProfWriter::validateRecord(const InstrProfRecord &Func) {
for (uint32_t VK = 0; VK <= IPVK_Last; VK++) {
- uint32_t NS = Func.getNumValueSites(VK);
- if (!NS)
+ if (VK == IPVK_IndirectCallTarget || VK == IPVK_VTableTarget)
continue;
+ uint32_t NS = Func.getNumValueSites(VK);
for (uint32_t S = 0; S < NS; S++) {
- uint32_t ND = Func.getNumValueDataForSite(VK, S);
- std::unique_ptr<InstrProfValueData[]> VD = Func.getValueForSite(VK, S);
DenseSet<uint64_t> SeenValues;
- for (uint32_t I = 0; I < ND; I++)
- if ((VK != IPVK_IndirectCallTarget && VK != IPVK_VTableTarget) &&
----------------
kazutakahirata wrote:
I happen to have a raw instrumentation profile lying around for clang (that is, clang as an application). When I generate an indexed profile with `validateRecord` modified to check all value profile kinds, including `IPVK_IndirectCallTarget` and `IPVK_VTableTarget`, then I get an `invalid_prof` error. So, duplicate values for the two kinds seem to be a real thing. I have yet to investigate where they come from though.
https://github.com/llvm/llvm-project/pull/95488
More information about the llvm-commits
mailing list