For testing, I was currently thinking of a two pronged approach. Lit tests as you suggest with a dummy pass, probably with command line options to define what transform to do, and unit tests to test the delegate behaviour and return values.
I’ll try and produce a mega patch with at least the loop vectoriser moved over, then split it up again after review.
I think refactoring the commonalities into a LoopEditor makes sense.
The LoopVectorizer has grown to be a class with a lot of functionality. Moving some of the parts shared with other loop optimization passes makes sense to me. As we want to tackle more and more loop nest optimizations I think this will become imperative to maintainability.
Most of the interesting state in the vectorizer will move to the delegate.