Refactor optimization pass handling.

Refactor the optimization passes to explicitly use the passes. This commit
just re-implements the same passes as were already being run.

It also adds an option (behind `-Z`) to run the LLVM lint pass on the
unoptimized IR.
Fix pass creation typo
Move the initial dead prototype removal pass
Remove passes that were causing bad optmizations
Remove now-unused import
Remove extraneous defs from export file