OSDN Git Service

[llvm-profdata] Report if profile data file is IR- or FE-level
authorAdam Nemet <anemet@apple.com>
Tue, 14 Nov 2017 16:59:18 +0000 (16:59 +0000)
committerAdam Nemet <anemet@apple.com>
Tue, 14 Nov 2017 16:59:18 +0000 (16:59 +0000)
Differential Revision: https://reviews.llvm.org/D39997

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@318159 91177308-0d34-0410-b5e6-96231b3b80d8

test/tools/llvm-profdata/show-instr-level.test [new file with mode: 0644]
tools/llvm-profdata/llvm-profdata.cpp

diff --git a/test/tools/llvm-profdata/show-instr-level.test b/test/tools/llvm-profdata/show-instr-level.test
new file mode 100644 (file)
index 0000000..ed00326
--- /dev/null
@@ -0,0 +1,7 @@
+RUN: llvm-profdata merge -o %t_clang.profdata %p/Inputs/clang_profile.proftext
+RUN: llvm-profdata show %t_clang.profdata | FileCheck %s -check-prefix=FE
+FE: Instrumentation level: Front-end
+
+RUN: llvm-profdata merge -o %t_ir.profdata %p/Inputs/IR_profile.proftext
+RUN: llvm-profdata show %t_ir.profdata | FileCheck %s -check-prefix=IR
+IR: Instrumentation level: IR
index 8e21a7a..000bca2 100644 (file)
@@ -625,6 +625,8 @@ static int showInstrProfile(const std::string &Filename, bool ShowCounts,
   if (ShowCounts && TextFormat)
     return 0;
   std::unique_ptr<ProfileSummary> PS(Builder.getSummary());
+  OS << "Instrumentation level: "
+     << (Reader->isIRLevelProfile() ? "IR" : "Front-end") << "\n";
   if (ShowAllFunctions || !ShowFunction.empty())
     OS << "Functions shown: " << ShownFunctions << "\n";
   OS << "Total functions: " << PS->getNumFunctions() << "\n";