summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xpolly/include/polly/ScopDetection.h9
-rw-r--r--polly/lib/Analysis/ScopDetection.cpp98
-rw-r--r--polly/lib/RegisterPasses.cpp3
3 files changed, 69 insertions, 41 deletions
diff --git a/polly/include/polly/ScopDetection.h b/polly/include/polly/ScopDetection.h
index 6ee48ee7cd5..dd5b630bae3 100755
--- a/polly/include/polly/ScopDetection.h
+++ b/polly/include/polly/ScopDetection.h
@@ -72,6 +72,8 @@ class Value;
namespace polly {
typedef std::set<const SCEV *> ParamSetType;
+extern bool PollyTrackFailures;
+
//===----------------------------------------------------------------------===//
/// @brief Pass to detect the maximal static control parts (Scops) of a
/// function.
@@ -145,6 +147,13 @@ class ScopDetection : public FunctionPass {
/// @return True if the call instruction is valid, false otherwise.
static bool isValidCallInst(CallInst &CI);
+ /// @brief Format the invalid alias message.
+ ///
+ /// @param AS The alias set.
+ ///
+ /// @return The failure message why the alias is invalid.
+ std::string formatInvalidAlias(AliasSet &AS) const;
+
/// @brief Check if a memory access can be part of a Scop.
///
/// @param Inst The instruction accessing the memory.
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;
}
diff --git a/polly/lib/RegisterPasses.cpp b/polly/lib/RegisterPasses.cpp
index 7fc0960ee69..26a138eb796 100644
--- a/polly/lib/RegisterPasses.cpp
+++ b/polly/lib/RegisterPasses.cpp
@@ -317,6 +317,9 @@ registerPollyEarlyAsPossiblePasses(const llvm::PassManagerBuilder &Builder,
if (Builder.OptLevel == 0)
return;
+ if (PollyOnlyPrinter || PollyPrinter || PollyOnlyViewer || PollyViewer)
+ PollyTrackFailures = true;
+
if (PollyOnlyPrinter || PollyPrinter || PollyOnlyViewer || PollyViewer ||
ExportJScop || ImportJScop)
PollyEnabled = true;
OpenPOWER on IntegriCloud