[llvm-commits] [polly] r141458 - in /polly/trunk: include/polly/ScopDetection.h lib/Analysis/ScopDetection.cpp lib/Analysis/ScopGraphPrinter.cpp

Tobias Grosser grosser at fim.uni-passau.de
Fri Oct 7 17:30:55 PDT 2011


Author: grosser
Date: Fri Oct  7 19:30:55 2011
New Revision: 141458

URL: http://llvm.org/viewvc/llvm-project?rev=141458&view=rev
Log:
Show the reason a region is not a SCoP in the DOT graphs.

Modified:
    polly/trunk/include/polly/ScopDetection.h
    polly/trunk/lib/Analysis/ScopDetection.cpp
    polly/trunk/lib/Analysis/ScopGraphPrinter.cpp

Modified: polly/trunk/include/polly/ScopDetection.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/ScopDetection.h?rev=141458&r1=141457&r2=141458&view=diff
==============================================================================
--- polly/trunk/include/polly/ScopDetection.h (original)
+++ polly/trunk/include/polly/ScopDetection.h Fri Oct  7 19:30:55 2011
@@ -109,6 +109,7 @@
   // Remember the invalid functions producted by backends;
   typedef std::set<const Function*> FunctionSet;
   FunctionSet InvalidFunctions;
+  mutable std::string LastFailure;
 
   // Try to expand the region R. If R can be expanded return the expanded
   // region, NULL otherwise.
@@ -233,6 +234,13 @@
   /// @return Return true if R is the maximum Region in a Scop, false otherwise.
   bool isMaxRegionInScop(const Region &R) const;
 
+  /// @brief Get a message why a region is invalid
+  ///
+  /// @param R The region for which we get the error message
+  ///
+  /// @return The error or "" if no error appeared.
+  std::string regionIsInvalidBecause(const Region *R) const;
+
   /// @name Maximum Region In Scops Iterators
   ///
   /// These iterators iterator over all maximum region in Scops of this

Modified: polly/trunk/lib/Analysis/ScopDetection.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopDetection.cpp?rev=141458&r1=141457&r2=141458&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopDetection.cpp (original)
+++ polly/trunk/lib/Analysis/ScopDetection.cpp Fri Oct  7 19:30:55 2011
@@ -77,6 +77,11 @@
 
 #define INVALID(NAME, MESSAGE) \
   do { \
+    std::string Buf; \
+    raw_string_ostream fmt(Buf); \
+    fmt << MESSAGE; \
+    fmt.flush(); \
+    LastFailure = Buf; \
     DEBUG(dbgs() << MESSAGE); \
     DEBUG(dbgs() << "\n"); \
     STATSCOP(NAME); \
@@ -102,6 +107,14 @@
   return ValidRegions.count(&R);
 }
 
+std::string ScopDetection::regionIsInvalidBecause(const Region *R) const {
+  if (!InvalidRegions.count(R))
+    return "";
+
+  return InvalidRegions.find(R)->second;
+}
+
+
 bool ScopDetection::isValidAffineFunction(const SCEV *S, Region &RefRegion,
                                           Value **BasePtr) const {
   assert(S && "S must not be null!");
@@ -438,6 +451,8 @@
     return;
   }
 
+  InvalidRegions[&R] = LastFailure;
+
   for (Region::iterator I = R.begin(), E = R.end(); I != E; ++I)
     findScops(**I);
 
@@ -583,6 +598,7 @@
 
 void ScopDetection::releaseMemory() {
   ValidRegions.clear();
+  InvalidRegions.clear();
   // Do not clear the invalid function set.
 }
 

Modified: polly/trunk/lib/Analysis/ScopGraphPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopGraphPrinter.cpp?rev=141458&r1=141457&r2=141458&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopGraphPrinter.cpp (original)
+++ polly/trunk/lib/Analysis/ScopGraphPrinter.cpp Fri Oct  7 19:30:55 2011
@@ -107,7 +107,8 @@
                                  raw_ostream &O, unsigned depth = 0) {
     O.indent(2 * depth) << "subgraph cluster_" << static_cast<const void*>(R)
       << " {\n";
-    O.indent(2 * (depth + 1)) << "label = \"\";\n";
+    std::string ErrorMessage = SD->regionIsInvalidBecause(R);
+    O.indent(2 * (depth + 1)) << "label = \"" << ErrorMessage << "\";\n";
 
     if (SD->isMaxRegionInScop(*R)) {
       O.indent(2 * (depth + 1)) << "style = filled;\n";





More information about the llvm-commits mailing list