[llvm] [ProfileData] Clean up validateRecord (PR #95488)

David Li via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 13 21:13:21 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) &&
----------------
david-xl wrote:

No producer can generate dups for value profile data, so there is probably no need to specialize these two kinds. Can be cleaned up later.

https://github.com/llvm/llvm-project/pull/95488


More information about the llvm-commits mailing list