LLVM-Reduce

Tool for Test-Case Reduction of LLVM IR.

https://blog.regehr.org/archives/2109

Example

llvm-reduce-10 --test=test.sh prog.bc
#!/usr/bin/env bash

llvm-as-10 "${1}"
bc="${1%.ll}.bc"

my_command "${bc}" &> /dev/null
if [[ ${MY_ASSERTION_FAILED} ]]; then
  printf "\nInput is still 'interesting'\n"
  exit 0
else
  printf "\nInput is no longer 'interesting'\n"
  exit 1
fi

Saving as You Go

There doesn't appear to be an option to save as you go (useful if you've got a long running test), but you can just copy files from "/tmp" or have your test script copy $1 somewhere.

Options

It appears that --help prints the whole help of opt… You can always read the source!