[PGO] Improve Indexed Profile Reader efficiency
[oota-llvm.git] / tools / llvm-profdata / llvm-profdata.cpp
index 71768f92382a584c4049296e552ab9f65cbccb5a..dc6cd0a5784d615ff7c2bfaa3f13bd1df0b19e41 100644 (file)
@@ -267,7 +267,8 @@ static int showInstrProfile(std::string Filename, bool ShowCounts,
     bool doTextFormatDump = (Show && ShowCounts && TextFormat);
 
     if (doTextFormatDump) {
     bool doTextFormatDump = (Show && ShowCounts && TextFormat);
 
     if (doTextFormatDump) {
-      InstrProfWriter::writeRecordInText(Func, OS);
+      InstrProfSymtab &Symtab = Reader->getSymtab();
+      InstrProfWriter::writeRecordInText(Func, Symtab, OS);
       continue;
     }
 
       continue;
     }
 
@@ -306,6 +307,7 @@ static int showInstrProfile(std::string Filename, bool ShowCounts,
       }
 
       if (ShowIndirectCallTargets) {
       }
 
       if (ShowIndirectCallTargets) {
+        InstrProfSymtab &Symtab = Reader->getSymtab();
         uint32_t NS = Func.getNumValueSites(IPVK_IndirectCallTarget);
         OS << "    Indirect Target Results: \n";
         for (size_t I = 0; I < NS; ++I) {
         uint32_t NS = Func.getNumValueSites(IPVK_IndirectCallTarget);
         OS << "    Indirect Target Results: \n";
         for (size_t I = 0; I < NS; ++I) {
@@ -314,7 +316,8 @@ static int showInstrProfile(std::string Filename, bool ShowCounts,
               Func.getValueForSite(IPVK_IndirectCallTarget, I);
           for (uint32_t V = 0; V < NV; V++) {
             OS << "\t[ " << I << ", ";
               Func.getValueForSite(IPVK_IndirectCallTarget, I);
           for (uint32_t V = 0; V < NV; V++) {
             OS << "\t[ " << I << ", ";
-            OS << (const char *)VD[V].Value << ", " << VD[V].Count << " ]\n";
+            OS << Symtab.getFuncName(VD[V].Value) << ", " << VD[V].Count
+               << " ]\n";
           }
         }
       }
           }
         }
       }