summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/BlockFrequencyInfo.cpp
diff options
context:
space:
mode:
authorHiroshi Yamauchi <yamauchi@google.com>2017-09-13 17:20:38 +0000
committerHiroshi Yamauchi <yamauchi@google.com>2017-09-13 17:20:38 +0000
commita43913cfaf3ea2202a39c02d19ccc05a0a2fe193 (patch)
tree766e4d68e2e0146a8fd1286d30c03cdcff46657b /llvm/lib/Analysis/BlockFrequencyInfo.cpp
parentcbdc5ff628535761663367ab67621087aadd0d5f (diff)
downloadbcm5719-llvm-a43913cfaf3ea2202a39c02d19ccc05a0a2fe193.tar.gz
bcm5719-llvm-a43913cfaf3ea2202a39c02d19ccc05a0a2fe193.zip
Add options to dump PGO counts in text.
Summary: Added text options to -pgo-view-counts and -pgo-view-raw-counts that dump block frequency and branch probability info in text. This is useful when the graph is very large and complex (the dot command crashes, lines/edges too close to tell apart, hard to navigate without textual search) or simply when text is preferred. Reviewers: davidxl Reviewed By: davidxl Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D37776 llvm-svn: 313159
Diffstat (limited to 'llvm/lib/Analysis/BlockFrequencyInfo.cpp')
-rw-r--r--llvm/lib/Analysis/BlockFrequencyInfo.cpp31
1 files changed, 17 insertions, 14 deletions
diff --git a/llvm/lib/Analysis/BlockFrequencyInfo.cpp b/llvm/lib/Analysis/BlockFrequencyInfo.cpp
index fd41a6a8e20..5d2170dcf15 100644
--- a/llvm/lib/Analysis/BlockFrequencyInfo.cpp
+++ b/llvm/lib/Analysis/BlockFrequencyInfo.cpp
@@ -61,19 +61,22 @@ cl::opt<unsigned>
"is no less than the max frequency of the "
"function multiplied by this percent."));
-// Command line option to turn on CFG dot dump after profile annotation.
-cl::opt<bool>
- PGOViewCounts("pgo-view-counts", cl::init(false), cl::Hidden,
- cl::desc("A boolean option to show CFG dag with "
- "block profile counts and branch probabilities "
- "right after PGO profile annotation step. The "
- "profile counts are computed using branch "
- "probabilities from the runtime profile data and "
- "block frequency propagation algorithm. To view "
- "the raw counts from the profile, use option "
- "-pgo-view-raw-counts instead. To limit graph "
- "display to only one function, use filtering option "
- "-view-bfi-func-name."));
+// Command line option to turn on CFG dot or text dump after profile annotation.
+cl::opt<PGOViewCountsType> PGOViewCounts(
+ "pgo-view-counts", cl::Hidden,
+ cl::desc("A boolean option to show CFG dag or text with "
+ "block profile counts and branch probabilities "
+ "right after PGO profile annotation step. The "
+ "profile counts are computed using branch "
+ "probabilities from the runtime profile data and "
+ "block frequency propagation algorithm. To view "
+ "the raw counts from the profile, use option "
+ "-pgo-view-raw-counts instead. To limit graph "
+ "display to only one function, use filtering option "
+ "-view-bfi-func-name."),
+ cl::values(clEnumValN(PGOVCT_None, "none", "do not show."),
+ clEnumValN(PGOVCT_Graph, "graph", "show a graph."),
+ clEnumValN(PGOVCT_Text, "text", "show in text.")));
static cl::opt<bool> PrintBlockFreq(
"print-bfi", cl::init(false), cl::Hidden,
@@ -87,7 +90,7 @@ cl::opt<std::string> PrintBlockFreqFuncName(
namespace llvm {
static GVDAGType getGVDT() {
- if (PGOViewCounts)
+ if (PGOViewCounts == PGOVCT_Graph)
return GVDT_Count;
return ViewBlockFreqPropagationDAG;
}
OpenPOWER on IntegriCloud