[polly] r255891 - ScopGraphPrinter: Only show functions that contain at least one scop

Tobias Grosser via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 17 04:55:26 PST 2015


Author: grosser
Date: Thu Dec 17 06:55:26 2015
New Revision: 255891

URL: http://llvm.org/viewvc/llvm-project?rev=255891&view=rev
Log:
ScopGraphPrinter: Only show functions that contain at least one scop

When running 'clang -O3 -mllvm -polly -mllvm -polly-show' we now only show the
CFGs of functions with at least one detected scop. For larger files/projects
this reduces the number of graphs printed significantly and is likely what
developers want to see. The new option -polly-view-all enforces all graphs to be
printed and the exiting option -poll-view-only limites the graph printing to
functions that match a certain pattern.

This patch requires https://llvm.org/svn/llvm-project/llvm/trunk@255889 (and
vice versa) to compile correctly.

Modified:
    polly/trunk/lib/Analysis/ScopGraphPrinter.cpp

Modified: polly/trunk/lib/Analysis/ScopGraphPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopGraphPrinter.cpp?rev=255891&r1=255890&r2=255891&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopGraphPrinter.cpp (original)
+++ polly/trunk/lib/Analysis/ScopGraphPrinter.cpp Thu Dec 17 06:55:26 2015
@@ -29,6 +29,11 @@ static cl::opt<std::string>
                cl::desc("Only view functions that match this pattern"),
                cl::Hidden, cl::init(""), cl::ZeroOrMore);
 
+static cl::opt<bool>
+    ViewAll("polly-view-all",
+            cl::desc("Also show functions without any scops"),
+            cl::Hidden, cl::init(false), cl::ZeroOrMore);
+
 namespace llvm {
 template <>
 struct GraphTraits<ScopDetection *> : public GraphTraits<RegionInfo *> {
@@ -178,14 +183,15 @@ struct DOTGraphTraits<ScopDetection *> :
 struct ScopViewer : public DOTGraphTraitsViewer<ScopDetection, false> {
   static char ID;
   ScopViewer() : DOTGraphTraitsViewer<ScopDetection, false>("scops", ID) {}
-  bool processFunction(Function &F) override {
-    if (ViewFilter == "")
-      return true;
+  bool processFunction(Function &F, ScopDetection &SD) override {
+    if (ViewFilter != "" && !F.getName().count(ViewFilter))
+      return false;
 
-    if (F.getName().count(ViewFilter))
+    if (ViewAll)
       return true;
 
-    return false;
+    // Check that at least one scop was detected.
+    return std::distance(SD.begin(), SD.end()) > 0;
   }
 };
 char ScopViewer::ID = 0;




More information about the llvm-commits mailing list