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"),
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;
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
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))
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));