Add -func param to alive-tv
RENAME
tests/alive-tv/dbg.src.ll
tests/alive-tv/params/dbg.src.ll
RENAME
tests/alive-tv/dbg.tgt.ll
tests/alive-tv/params/dbg.tgt.ll
ADD
tests/alive-tv/params/func-fail.src.ll
+; TEST-ARGS: -func=b -func=c
+
+define i32 @a() {
+ ret i32 0
+}
+
+define i32 @b() {
+ ret i32 1
+}
+
+define i32 @c() {
+ ret i32 2
+}
+; ERROR: Value mismatch

ADD
tests/alive-tv/params/func-fail.tgt.ll
+define i32 @a() {
+ ret i32 0
+}
+
+define i32 @b() {
+ ret i32 1
+}
+
+define i32 @c() {
+ ret i32 3
+}

ADD
tests/alive-tv/params/func.src.ll
+; TEST-ARGS: -func=a -func=b
+
+define i32 @a() {
+ ret i32 0
+}
+
+define i32 @b() {
+ ret i32 1
+}
+
+define i32 @c() {
+ ret i32 2
+}

ADD
tests/alive-tv/params/func.tgt.ll
+define i32 @a() {
+ ret i32 0
+}
+
+define i32 @b() {
+ ret i32 1
+}
+
+define i32 @c() {
+ ret i32 3
+}

MODIFY
tools/alive-tv.cpp
tools/alive-tv.cpp
@@ -66,6 +66,12 @@ static llvm::cl::opt<bool> opt_smt_verbose(
"smt-verbose", llvm::cl::desc("SMT verbose mode"),
llvm::cl::cat(opt_alive), llvm::cl::init(false));
+static llvm::cl::list<std::string> opt_funcs(
+ "func",
+ llvm::cl::desc("Specify the name of a function to verify (without @)"),
+ llvm::cl::ZeroOrMore, llvm::cl::value_desc("function name"),
+ llvm::cl::cat(opt_alive));
+
static llvm::cl::opt<bool> opt_tactic_verbose(
"tactic-verbose", llvm::cl::desc("SMT Tactic verbose mode"),
llvm::cl::cat(opt_alive), llvm::cl::init(false));
@@ -414,6 +420,10 @@ convenient way to demonstrate an existing optimizer bug.
}
{
+ set<string> funcNames;
+ for (const string &fnname: opt_funcs)
+ funcNames.insert(fnname);
+
auto targetTriple = llvm::Triple(M1.get()->getTargetTriple());
// FIXME: quadratic, may not be suitable for very large modules
// emitted by opt-fuzz
@@ -424,6 +434,8 @@ convenient way to demonstrate an existing optimizer bug.
if (F2.isDeclaration() ||
F1.getName() != F2.getName())
continue;
+ if (!funcNames.empty() && funcNames.count(F1.getName().str()) == 0)
+ continue;
compareFunctions(F1, F2, targetTriple, goodCount, badCount, errorCount);
break;
}

Add -func param to alive-tv (#327)