summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Simbuerger <simbuerg@fim.uni-passau.de>2014-05-24 09:25:10 +0000
committerAndreas Simbuerger <simbuerg@fim.uni-passau.de>2014-05-24 09:25:10 +0000
commit0447240ee93e8e686456b0a9a8b1a09245f10b83 (patch)
treeeab796d6017fa97e23d8aed41b9ef5bb5464dfc8
parent8a00c9bb0f5617bb047953111898f8aa810c7707 (diff)
downloadbcm5719-llvm-0447240ee93e8e686456b0a9a8b1a09245f10b83.tar.gz
bcm5719-llvm-0447240ee93e8e686456b0a9a8b1a09245f10b83.zip
ScopDetection: Support keep-going
Support a 'keep-going' mode for the ScopDetection. In this mode, we just keep on detecting, even if we encounter an error. This is useful for diagnosing SCoP candidates. Sometimes you want all the errors. Invalid SCoPs will still be refused in the end, we just refuse to abort on the first error. llvm-svn: 209574
-rw-r--r--polly/include/polly/ScopDetectionDiagnostic.h1
-rw-r--r--polly/lib/Analysis/ScopDetection.cpp24
2 files changed, 20 insertions, 5 deletions
diff --git a/polly/include/polly/ScopDetectionDiagnostic.h b/polly/include/polly/ScopDetectionDiagnostic.h
index 44b39b87e10..452e25da230 100644
--- a/polly/include/polly/ScopDetectionDiagnostic.h
+++ b/polly/include/polly/ScopDetectionDiagnostic.h
@@ -73,6 +73,7 @@ public:
iterator begin() { return ErrorReports.begin(); }
iterator end() { return ErrorReports.end(); }
+ size_t size() { return ErrorReports.size(); }
const Region *region() const { return R; }
void report(RejectReasonPtr Reject) { ErrorReports.push_back(Reject); }
diff --git a/polly/lib/Analysis/ScopDetection.cpp b/polly/lib/Analysis/ScopDetection.cpp
index 47803530b07..c45524c3754 100644
--- a/polly/lib/Analysis/ScopDetection.cpp
+++ b/polly/lib/Analysis/ScopDetection.cpp
@@ -117,6 +117,11 @@ TrackFailures("polly-detect-track-failures",
cl::location(PollyTrackFailures), cl::Hidden, cl::ZeroOrMore,
cl::init(false), cl::cat(PollyCategory));
+static cl::opt<bool> KeepGoing("polly-detect-keep-going",
+ cl::desc("Do not fail on the first error."),
+ cl::Hidden, cl::ZeroOrMore, cl::init(false),
+ cl::cat(PollyCategory));
+
static cl::opt<bool, true>
PollyDelinearizeX("polly-delinearize",
cl::desc("Delinearize array access functions"),
@@ -589,7 +594,10 @@ void ScopDetection::findScops(Region &R) {
if (!DetectRegionsWithoutLoops && regionWithoutLoops(R, LI))
return;
- if (isValidRegion(R)) {
+ bool IsValidRegion = isValidRegion(R);
+ bool HasErrors = RejectLogs.count(&R) > 0;
+
+ if (IsValidRegion && !HasErrors) {
++ValidRegion;
ValidRegions.insert(&R);
return;
@@ -598,6 +606,10 @@ void ScopDetection::findScops(Region &R) {
for (auto &SubRegion : R)
findScops(*SubRegion);
+ // Do not expand when we had errors. Bad things may happen.
+ if (IsValidRegion && HasErrors)
+ return;
+
// Try to expand regions.
//
// As the region tree normally only contains canonical regions, non canonical
@@ -635,17 +647,17 @@ bool ScopDetection::allBlocksValid(DetectionContext &Context) const {
for (const BasicBlock *BB : R.blocks()) {
Loop *L = LI->getLoopFor(BB);
- if (L && L->getHeader() == BB && !isValidLoop(L, Context))
+ if (L && L->getHeader() == BB && (!isValidLoop(L, Context) && !KeepGoing))
return false;
}
for (BasicBlock *BB : R.blocks())
- if (!isValidCFG(*BB, Context))
+ if (!isValidCFG(*BB, Context) && !KeepGoing)
return false;
for (BasicBlock *BB : R.blocks())
for (BasicBlock::iterator I = BB->begin(), E = --BB->end(); I != E; ++I)
- if (!isValidInstruction(*I, Context))
+ if (!isValidInstruction(*I, Context) && !KeepGoing)
return false;
if (!hasAffineMemoryAccesses(Context))
@@ -671,7 +683,9 @@ bool ScopDetection::isValidRegion(Region &R) const {
DetectionContext Context(R, *AA, false /*verifying*/);
bool RegionIsValid = isValidRegion(Context);
- if (PollyTrackFailures && !RegionIsValid) {
+ bool HasErrors = !RegionIsValid || Context.Log.size() > 0;
+
+ if (PollyTrackFailures && HasErrors) {
// std::map::insert does not replace.
std::pair<reject_iterator, bool> InsertedValue =
RejectLogs.insert(std::make_pair(&R, Context.Log));
OpenPOWER on IntegriCloud