[PGO] Value profiling (index format) code cleanup and testing
[oota-llvm.git] / tools / llvm-profdata / llvm-profdata.cpp
index 382ac908da4d09b320638eeae12c2e1bfcdb9c1e..48fc83c6971ba9196f245004e9c15f664415ada2 100644 (file)
@@ -168,8 +168,8 @@ static int showInstrProfile(std::string Filename, bool ShowCounts,
          << "    Counters: " << Func.Counts.size() << "\n"
          << "    Function count: " << Func.Counts[0] << "\n";
       if (ShowIndirectCallTargets)
-        OS << "    Indirect Call Site Count: " << Func.IndirectCallSites.size()
-           << "\n";
+        OS << "    Indirect Call Site Count: "
+           << Func.getNumValueSites(IPVK_IndirectCallTarget) << "\n";
     }
 
     if (Show && ShowCounts)
@@ -184,11 +184,15 @@ static int showInstrProfile(std::string Filename, bool ShowCounts,
       OS << "]\n";
 
     if (Show && ShowIndirectCallTargets) {
+      uint32_t NS = Func.getNumValueSites(IPVK_IndirectCallTarget);
       OS << "    Indirect Target Results: \n";
-      for (size_t I = 0, E = Func.IndirectCallSites.size(); I < E; ++I) {
-        for (auto V : Func.IndirectCallSites[I].ValueData) {
+      for (size_t I = 0; I < NS; ++I) {
+        uint32_t NV = Func.getNumValueDataForSite(IPVK_IndirectCallTarget, I);
+        std::unique_ptr<InstrProfValueData[]> VD =
+            Func.getValueForSite(IPVK_IndirectCallTarget, I);
+        for (uint32_t V = 0; V < NV; V++) {
           OS << "\t[ " << I << ", ";
-          OS << (const char *)V.first << ", " << V.second << " ]\n";
+          OS << (const char *)VD[V].Value << ", " << VD[V].Count << " ]\n";
         }
       }
     }