Add --succinct param, add CHECK-NOT directive
ADD
tests/alive-tv/params/succinct-correct.srctgt.ll
+; TEST-ARGS: -succinct
+
+define i32 @src(i32 %x) {
+ ret i32 %x
+}
+
+define i32 @tgt(i32 %x) {
+ %y = add i32 %x, 0
+ ret i32 %y
+}
+
+; CHECK: Transformation seems to be correct!
+; CHECK-NOT: define i32 @src

ADD
tests/alive-tv/params/succinct-incorrect.srctgt.ll
+; TEST-ARGS: -succinct
+
+define i32 @src(i32 %x) {
+ ret i32 %x
+}
+
+define i32 @tgt(i32 %x) {
+ %y = add i32 %x, 1
+ ret i32 %y
+}
+
+; CHECK: Transformation doesn't verify!
+; CHECK-NOT: define i32 @src
+; CHECK-NOT: ERROR:

MODIFY
tests/lit/lit/formats/alive2test.py
tests/lit/lit/formats/alive2test.py
@@ -41,6 +41,7 @@ class Alive2Test(TestFormat):
self.regex_xfail = re.compile(r";\s*XFAIL:\s*(.*)")
self.regex_args = re.compile(r";\s*TEST-ARGS:(.*)")
self.regex_check = re.compile(r";\s*CHECK:(.*)")
+ self.regex_check_not = re.compile(r";\s*CHECK-NOT:(.*)")
self.regex_errs_out = re.compile("ERROR:.*")
def getTestsInDirectory(self, testSuite, path_in_suite,
@@ -107,20 +108,27 @@ class Alive2Test(TestFormat):
expect_err = self.regex_errs.search(input)
xfail = self.regex_xfail.search(input)
chk = self.regex_check.search(input)
+ chk_not = self.regex_check_not.search(input)
+
+ # Check XFAIL early.
+ if xfail != None and (out + err).find(xfail.group(1)) != -1:
+ return lit.Test.XFAIL, ''
if chk != None and (out + err).find(chk.group(1).strip()) == -1:
return lit.Test.FAIL, out + err
- if expect_err is None and xfail is None:
+ if chk_not != None and (out + err).find(chk_not.group(1).strip()) != -1:
+ return lit.Test.FAIL, out + err
+
+ if expect_err is None and xfail is None and chk is None and chk_not is None:
+ # If there's no other test, correctness of the transformation should be
+ # checked.
if exitCode == 0 and (out + err).find(ok_string) != -1 and \
self.regex_errs_out.search(out + err) is None:
return lit.Test.PASS, ''
return lit.Test.FAIL, out + err
- if expect_err != None and (out + err).find(expect_err.group(1)) != -1:
- return lit.Test.PASS, ''
-
- if xfail != None and (out + err).find(xfail.group(1)) != -1:
- return lit.Test.XFAIL, ''
-
+ if expect_err != None and (out + err).find(expect_err.group(1)) == -1:
return lit.Test.FAIL, out + err
+
+ return lit.Test.PASS, ''

MODIFY
tools/alive-tv.cpp
tools/alive-tv.cpp
@@ -84,6 +84,10 @@ static llvm::cl::opt<bool> opt_smt_stats(
"smt-stats", llvm::cl::desc("Show SMT statistics"),
llvm::cl::cat(opt_alive), llvm::cl::init(false));
+static llvm::cl::opt<bool> opt_succinct(
+ "succinct", llvm::cl::desc("Make the output succinct"),
+ llvm::cl::cat(opt_alive), llvm::cl::init(false));
+
static llvm::cl::opt<unsigned> opt_max_mem(
"max-mem", llvm::cl::desc("Max memory (approx)"),
llvm::cl::cat(opt_alive), llvm::cl::init(1024), llvm::cl::value_desc("MB"));
@@ -243,6 +247,7 @@ static void compareFunctions(llvm::Function &F1, llvm::Function &F2,
t.src = move(*Func1);
t.tgt = move(*Func2);
TransformVerify verifier(t, false);
+ if (!opt_succinct)
t.print(cout, print_opts);
{
@@ -260,7 +265,9 @@ static void compareFunctions(llvm::Function &F1, llvm::Function &F2,
bool result(errs);
if (result) {
if (errs.isUnsound()) {
- cout << "Transformation doesn't verify!\n" << errs << endl;
+ cout << "Transformation doesn't verify!\n";
+ if (!opt_succinct)
+ cout << errs << endl;
++badCount;
} else {
cerr << errs << endl;

Add --succinct param, add CHECK-NOT directive (#333)