[polly] r209573 - Substitue LastError & InvalidRegions with RejectLogs

Andreas Simbuerger simbuerg at fim.uni-passau.de
Sat May 24 02:25:06 PDT 2014


Author: simbuerg
Date: Sat May 24 04:25:06 2014
New Revision: 209573

URL: http://llvm.org/viewvc/llvm-project?rev=209573&view=rev
Log:
Substitue LastError & InvalidRegions with RejectLogs

Use the new ScopDetectionDiagnostics to implement
the same functionality.

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

Modified: polly/trunk/include/polly/ScopDetection.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/ScopDetection.h?rev=209573&r1=209572&r2=209573&view=diff
==============================================================================
--- polly/trunk/include/polly/ScopDetection.h (original)
+++ polly/trunk/include/polly/ScopDetection.h Sat May 24 04:25:06 2014
@@ -115,16 +115,12 @@ class ScopDetection : public FunctionPas
   typedef std::set<const Region *> RegionSet;
   RegionSet ValidRegions;
 
-  // Invalid regions and the reason they fail.
-  std::map<const Region *, std::string> InvalidRegions;
-
   // Remember a list of errors for every region.
   mutable std::map<const Region *, RejectLog> RejectLogs;
 
   // Remember the invalid functions producted by backends;
   typedef std::set<const Function *> FunctionSet;
   FunctionSet InvalidFunctions;
-  mutable std::string LastFailure;
 
   // Delinearize all non affine memory accesses and return false when there
   // exists a non affine memory access that cannot be delinearized. Return true

Modified: polly/trunk/lib/Analysis/ScopDetection.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopDetection.cpp?rev=209573&r1=209572&r2=209573&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopDetection.cpp (original)
+++ polly/trunk/lib/Analysis/ScopDetection.cpp Sat May 24 04:25:06 2014
@@ -185,10 +185,8 @@ inline bool ScopDetection::invalid(Detec
     RejectLog &Log = Context.Log;
     std::shared_ptr<RR> RejectReason = std::make_shared<RR>(Arguments...);
 
-    if (PollyTrackFailures) {
+    if (PollyTrackFailures)
       Log.report(RejectReason);
-      LastFailure = RejectReason->getMessage();
-    }
 
     DEBUG(dbgs() << RejectReason->getMessage());
     DEBUG(dbgs() << "\n");
@@ -210,10 +208,13 @@ bool ScopDetection::isMaxRegionInScop(co
 }
 
 std::string ScopDetection::regionIsInvalidBecause(const Region *R) const {
-  if (!InvalidRegions.count(R))
+  if (!RejectLogs.count(R))
     return "";
 
-  return InvalidRegions.find(R)->second;
+  // Get the first error we found. Even in keep-going mode, this is the first
+  // reason that caused the candidate to be rejected.
+  RejectLog Errors = RejectLogs.at(R);
+  return (*Errors.begin())->getMessage();
 }
 
 bool ScopDetection::isValidCFG(BasicBlock &BB,
@@ -588,16 +589,12 @@ void ScopDetection::findScops(Region &R)
   if (!DetectRegionsWithoutLoops && regionWithoutLoops(R, LI))
     return;
 
-  LastFailure = "";
-
   if (isValidRegion(R)) {
     ++ValidRegion;
     ValidRegions.insert(&R);
     return;
   }
 
-  InvalidRegions[&R] = LastFailure;
-
   for (auto &SubRegion : R)
     findScops(*SubRegion);
 
@@ -833,7 +830,6 @@ void ScopDetection::print(raw_ostream &O
 
 void ScopDetection::releaseMemory() {
   ValidRegions.clear();
-  InvalidRegions.clear();
   RejectLogs.clear();
 
   // Do not clear the invalid function set.





More information about the llvm-commits mailing list