[llvm] r273992 - [BFI]: enhance BFI graph dump

Xinliang David Li via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 27 21:07:03 PDT 2016


Author: davidxl
Date: Mon Jun 27 23:07:03 2016
New Revision: 273992

URL: http://llvm.org/viewvc/llvm-project?rev=273992&view=rev
Log:
[BFI]: enhance BFI graph dump

MBFI supports profile count dumping and function
name based filtering. Add these two feature to
BFI as well. The filtering option is shared between
BFI and MBFI: -view-bfi-func-name=..



Modified:
    llvm/trunk/lib/Analysis/BlockFrequencyInfo.cpp
    llvm/trunk/lib/CodeGen/MachineBlockFrequencyInfo.cpp

Modified: llvm/trunk/lib/Analysis/BlockFrequencyInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/BlockFrequencyInfo.cpp?rev=273992&r1=273991&r2=273992&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/BlockFrequencyInfo.cpp (original)
+++ llvm/trunk/lib/Analysis/BlockFrequencyInfo.cpp Mon Jun 27 23:07:03 2016
@@ -27,18 +27,22 @@ using namespace llvm;
 #define DEBUG_TYPE "block-freq"
 
 #ifndef NDEBUG
-static cl::opt<GVDAGType>
-ViewBlockFreqPropagationDAG("view-block-freq-propagation-dags", cl::Hidden,
-          cl::desc("Pop up a window to show a dag displaying how block "
-                   "frequencies propagation through the CFG."),
-          cl::values(
-            clEnumValN(GVDT_None, "none",
-                       "do not display graphs."),
-            clEnumValN(GVDT_Fraction, "fraction", "display a graph using the "
-                       "fractional block frequency representation."),
-            clEnumValN(GVDT_Integer, "integer", "display a graph using the raw "
-                       "integer fractional block frequency representation."),
-            clEnumValEnd));
+static cl::opt<GVDAGType> ViewBlockFreqPropagationDAG(
+    "view-block-freq-propagation-dags", cl::Hidden,
+    cl::desc("Pop up a window to show a dag displaying how block "
+             "frequencies propagation through the CFG."),
+    cl::values(clEnumValN(GVDT_None, "none", "do not display graphs."),
+               clEnumValN(GVDT_Fraction, "fraction",
+                          "display a graph using the "
+                          "fractional block frequency representation."),
+               clEnumValN(GVDT_Integer, "integer",
+                          "display a graph using the raw "
+                          "integer fractional block frequency representation."),
+               clEnumValN(GVDT_Count, "count", "display a graph using the real "
+                                               "profile count if available."),
+               clEnumValEnd));
+
+cl::opt<std::string> ViewBlockFreqFuncName("view-bfi-func-name", cl::Hidden);
 
 namespace llvm {
 
@@ -113,8 +117,11 @@ void BlockFrequencyInfo::calculate(const
     BFI.reset(new ImplType);
   BFI->calculate(F, BPI, LI);
 #ifndef NDEBUG
-  if (ViewBlockFreqPropagationDAG != GVDT_None)
+  if (ViewBlockFreqPropagationDAG != GVDT_None &&
+      (ViewBlockFreqFuncName.empty() ||
+       F.getName().equals(ViewBlockFreqFuncName))) {
     view();
+  }
 #endif
 }
 

Modified: llvm/trunk/lib/CodeGen/MachineBlockFrequencyInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineBlockFrequencyInfo.cpp?rev=273992&r1=273991&r2=273992&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineBlockFrequencyInfo.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineBlockFrequencyInfo.cpp Mon Jun 27 23:07:03 2016
@@ -46,8 +46,7 @@ static cl::opt<GVDAGType> ViewMachineBlo
 
                clEnumValEnd));
 
-static cl::opt<std::string> ViewMachineBlockFreqFuncName("view-mbfi-func-name",
-                                                         cl::Hidden);
+extern cl::opt<std::string> ViewBlockFreqFuncName;
 
 namespace llvm {
 
@@ -134,8 +133,8 @@ bool MachineBlockFrequencyInfo::runOnMac
   MBFI->calculate(F, MBPI, MLI);
 #ifndef NDEBUG
   if (ViewMachineBlockFreqPropagationDAG != GVDT_None &&
-      (ViewMachineBlockFreqFuncName.empty() ||
-       F.getName().equals(ViewMachineBlockFreqFuncName))) {
+      (ViewBlockFreqFuncName.empty() ||
+       F.getName().equals(ViewBlockFreqFuncName))) {
     view();
   }
 #endif




More information about the llvm-commits mailing list