diff options
Diffstat (limited to 'polly/lib/Analysis/ScopDetection.cpp')
| -rw-r--r-- | polly/lib/Analysis/ScopDetection.cpp | 98 |
1 files changed, 57 insertions, 41 deletions
diff --git a/polly/lib/Analysis/ScopDetection.cpp b/polly/lib/Analysis/ScopDetection.cpp index 9b2a9a8ce57..d06b5fccb84 100644 --- a/polly/lib/Analysis/ScopDetection.cpp +++ b/polly/lib/Analysis/ScopDetection.cpp @@ -98,6 +98,14 @@ AllowNonAffine("polly-allow-nonaffine", cl::desc("Allow non affine access functions in arrays"), cl::Hidden, cl::init(false), cl::cat(PollyCategory)); +static cl::opt<bool, true> +TrackFailures("polly-detect-track-failures", + cl::desc("Track failure strings in detecting scop regions"), + cl::location(PollyTrackFailures), cl::Hidden, cl::init(false), + cl::cat(PollyCategory)); + +bool polly::PollyTrackFailures = false; + //===----------------------------------------------------------------------===// // Statistics. @@ -108,11 +116,13 @@ STATISTIC(ValidRegion, "Number of regions that a valid part of Scop"); #define INVALID(NAME, MESSAGE) \ do { \ - std::string Buf; \ - raw_string_ostream fmt(Buf); \ - fmt << MESSAGE; \ - fmt.flush(); \ - LastFailure = Buf; \ + if (PollyTrackFailures) { \ + std::string Buf; \ + raw_string_ostream fmt(Buf); \ + fmt << MESSAGE; \ + fmt.flush(); \ + LastFailure = Buf; \ + } \ DEBUG(dbgs() << MESSAGE); \ DEBUG(dbgs() << "\n"); \ assert(!Context.Verifying &&#NAME); \ @@ -122,11 +132,13 @@ STATISTIC(ValidRegion, "Number of regions that a valid part of Scop"); #define INVALID_NOVERIFY(NAME, MESSAGE) \ do { \ - std::string Buf; \ - raw_string_ostream fmt(Buf); \ - fmt << MESSAGE; \ - fmt.flush(); \ - LastFailure = Buf; \ + if (PollyTrackFailures) { \ + std::string Buf; \ + raw_string_ostream fmt(Buf); \ + fmt << MESSAGE; \ + fmt.flush(); \ + LastFailure = Buf; \ + } \ DEBUG(dbgs() << MESSAGE); \ DEBUG(dbgs() << "\n"); \ /* DISABLED: assert(!Context.Verifying && #NAME); */ \ @@ -256,6 +268,40 @@ bool ScopDetection::isValidCallInst(CallInst &CI) { return false; } +std::string ScopDetection::formatInvalidAlias(AliasSet &AS) const { + std::string Message; + raw_string_ostream OS(Message); + + OS << "Possible aliasing: "; + + std::vector<Value *> Pointers; + + for (AliasSet::iterator AI = AS.begin(), AE = AS.end(); AI != AE; ++AI) + Pointers.push_back(AI.getPointer()); + + std::sort(Pointers.begin(), Pointers.end()); + + for (std::vector<Value *>::iterator PI = Pointers.begin(), + PE = Pointers.end(); + ;) { + Value *V = *PI; + + if (V->getName().size() == 0) + OS << "\"" << *V << "\""; + else + OS << "\"" << V->getName() << "\""; + + ++PI; + + if (PI != PE) + OS << ", "; + else + break; + } + + return OS.str(); +} + bool ScopDetection::isValidMemoryAccess(Instruction &Inst, DetectionContext &Context) const { Value *Ptr = getPointerOperand(Inst); @@ -310,37 +356,7 @@ bool ScopDetection::isValidMemoryAccess(Instruction &Inst, // not proof this without -basicaa we would fail. We disable this check to // not cause irrelevant verification failures. if (!AS.isMustAlias()) { - std::string Message; - raw_string_ostream OS(Message); - - OS << "Possible aliasing: "; - - std::vector<Value *> Pointers; - - for (AliasSet::iterator AI = AS.begin(), AE = AS.end(); AI != AE; ++AI) - Pointers.push_back(AI.getPointer()); - - std::sort(Pointers.begin(), Pointers.end()); - - for (std::vector<Value *>::iterator PI = Pointers.begin(), - PE = Pointers.end(); - ;) { - Value *V = *PI; - - if (V->getName().size() == 0) - OS << "\"" << *V << "\""; - else - OS << "\"" << V->getName() << "\""; - - ++PI; - - if (PI != PE) - OS << ", "; - else - break; - } - - INVALID_NOVERIFY(Alias, OS.str()); + INVALID_NOVERIFY(Alias, formatInvalidAlias(AS)); return false; } |

