Announcing bug-reducer

Hey everyone.

Many of us from LLVM land are familiar with the tool called bugpoint. For a long time, we have wanted this in SIL, but no one has gotten around to doing it... until now! (What can I say I have tooling problems = p).

The tool called 'bug-reducer' is not a full bugpoint tool, but has what I believe to be the minimum functionality needed to be useful, namely:

1. Given a crashing sil-opt invocation, reduce the number of functions in the input file to a minimal set causing a crash.
2. Given a crashing sil-opt invocation, reduce the number of optimization passes run on the input file to a minimal set and then try to reduce functions.
3. A random pass pipeline generator that runs N rounds of a permuted performance optimization pipeline and tries to reduce the test cases using the above tools if a crash is found.

For guides on use, please see the README at: ./swift/utils/bug-reducer/README.md.

Consider this an early holiday gift from me to the Swift team. I hope it is useful. = ).

Michael

P.S. While this is currently focused just on optimizer passes, with a little work, we can:

1. Reduce blocks as well as functions.
2. Add a subtool for testing IRGen and LLVM.
3. Detect and reduce miscompilations.

This tool is written in python, so it should be relatively easy with a bit of guidance for someone not familiar with the internals of the compiler to hack on this.