add TV scripts for testing
ADD
scripts/run.php
+<?php
+// Copyright (c) 2018-present The Alive2 Authors.
+// Distributed under the MIT license that can be found in the LICENSE file.
+
+$file = @$argv[1];
+$optarg = @$argv[2];
+$alive = @$argv[3];
+if (!$file || !$optarg || !$alive)
+ die("usage: php run.php file.ll.bz2 llvm-opt alive <opt>\n");
+
+$optbin = empty($argv[4]) ? 'opt' : $argv[4];
+
+$ll = substr($file, 0, -4);
+
+`bunzip2 -k $file`;
+$txt = file_get_contents($ll);
+
+$regex = '/define \S* @([^(]+)([^{]*)\{([^}]+)\}/S';
+
+preg_match_all($regex, $txt, $m, PREG_SET_ORDER);
+foreach ($m as $opt) {
+ $orig[$opt[1]] = $opt[3];
+}
+
+$txt = `$optbin -S -$optarg $ll`;
+$output = '';
+preg_match_all($regex, $txt, $m, PREG_SET_ORDER);
+foreach ($m as $opt) {
+ $o = $orig[$opt[1]];
+ $nargs = count(explode(',', $opt[2]));
+ $opt[3] = rename_fn($opt[3], $nargs);
+ $o = "Name: $opt[1]$o=>$opt[3]\n";
+ if (strstr($o, 'undef'))
+ continue;
+ $output .= $o;
+}
+
+file_put_contents("$ll.alive.opt", $output);
+
+echo `$alive -root-only $ll.alive.opt 2>&1`;
+
+unlink($ll);
+unlink("$ll.alive.opt");
+
+
+function rename_fn($fn, $skip) {
+ return preg_replace_callback('/%(\d+)/', function($m) use($skip) {
+ return $m[1] > $skip ? "%_$m[1]" : $m[0];
+ }, $fn);
+}

ADD
scripts/runall.sh
+#!/bin/bash
+# Copyright (c) 2018-present The Alive2 Authors.
+# Distributed under the MIT license that can be found in the LICENSE file.
+
+FILES=$(ls input-2/*)
+OPTS="instsimplify instcombine O2 gvn newgvn sccp"
+ALIVE="~/alive2-build/alive"
+OPT="~/llvm-build/bin/opt"
+
+for optarg in $OPTS ; do
+ parallel --joblog joblog.$optarg.log \
+ "mkdir -p output/$optarg/{//} && \
+ /usr/bin/time php run.php {} $optarg $ALIVE $OPT &> output/$optarg/{.}.txt" \
+ ::: $FILES
+done

add TV scripts for testing