Convert optimizations to use the Pass infrastructure