namespace polly {
typedef std::set<const SCEV *> ParamSetType;
+extern bool PollyTrackFailures;
+
//===----------------------------------------------------------------------===//
/// @brief Pass to detect the maximal static control parts (Scops) of a
/// function.
/// @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.
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.
#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); \
#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); */ \
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);
// 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;
}