TV: don't give up if there are loops
MODIFY
tv/tv.cpp
tv/tv.cpp
@@ -123,7 +123,10 @@ struct TVPass : public llvm::FunctionPass {
if (Errors errs = verifier.verify()) {
*out << "Transformation doesn't verify!\n" << errs << endl;
- if (opt_error_fatal && !errs.isTimeout())
+ if (opt_error_fatal &&
+ !errs.isTimeout() &&
+ !errs.isOOM() &&
+ !errs.isLoopyCFG())
llvm::report_fatal_error("Alive2: Transform doesn't verify; aborting!");
} else {
*out << "Transformation seems to be correct!\n\n";

MODIFY
util/errors.cpp
util/errors.cpp
@@ -24,11 +24,16 @@ void Errors::add(string &&str) {
}
bool Errors::isTimeout() const {
- for (auto &err : errs) {
- if (err != "Timeout")
- return false;
+ return errs.size() == 1 && errs[0] == "Timeout";
}
- return !errs.empty();
+
+bool Errors::isOOM() const {
+ return errs.size() == 1 && errs[0] == "Out of memory; skipping function.";
+}
+
+bool Errors::isLoopyCFG() const {
+ return errs.size() == 1 &&
+ errs[0] == "Loops are not supported yet! Skipping function.";
}
ostream& operator<<(ostream &os, const Errors &errs) {

MODIFY
util/errors.h
util/errors.h
@@ -20,6 +20,8 @@ public:
void add(std::string &&str);
explicit operator bool() const { return !errs.empty(); }
bool isTimeout() const;
+ bool isOOM() const;
+ bool isLoopyCFG() const; // FIXME
friend std::ostream& operator<<(std::ostream &os, const Errors &e);
};

TV: don't give up if there are loops