diff options
-rw-r--r-- | polly/include/polly/ScopDetection.h | 4 | ||||
-rw-r--r-- | polly/lib/Analysis/ScopDetection.cpp | 16 |
2 files changed, 6 insertions, 14 deletions
diff --git a/polly/include/polly/ScopDetection.h b/polly/include/polly/ScopDetection.h index 8a7da6485fc..d9a261579cf 100644 --- a/polly/include/polly/ScopDetection.h +++ b/polly/include/polly/ScopDetection.h @@ -115,16 +115,12 @@ class ScopDetection : public FunctionPass { 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 diff --git a/polly/lib/Analysis/ScopDetection.cpp b/polly/lib/Analysis/ScopDetection.cpp index 90a5c1bfc9e..47803530b07 100644 --- a/polly/lib/Analysis/ScopDetection.cpp +++ b/polly/lib/Analysis/ScopDetection.cpp @@ -185,10 +185,8 @@ inline bool ScopDetection::invalid(DetectionContext &Context, bool Assert, 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(const Region &R, bool Verify) const { } 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 &OS, const Module *) const { void ScopDetection::releaseMemory() { ValidRegions.clear(); - InvalidRegions.clear(); RejectLogs.clear(); // Do not clear the invalid function set. |