LLVM's opt is very effective. I had a bug in my compiler such that it didn't compile all side effects, and opt removed the entire program!