The initial placement of vector-combine in the opt pipeline revealed phase ordering bugs:
https://bugs.llvm.org/show_bug.cgi?id=45015
https://bugs.llvm.org/show_bug.cgi?id=42022
This patch proposes a few changes:
- Move the pass up in the pipeline, so it happens just after loop-vectorization. This is only to keep vectorization passes together in the pipeline at the moment. I don't have any evidence of interaction between these yet.
- Add an -early-cse pass after -vector-combine to clean up redundant ops. This was partly proposed as far back as rL219644 (which is why it's effectively being moved in the old PM code). This is important because the subsequent -instcombine doesn't work as well without this. With the CSE, -instcombine is able to squash shuffles together in 1 of the tests (because those are simple "select" shuffles).
- Remove the -vector-combine pass that was running after SLP. We may want to do that eventually, but I don't have a test case to support it yet.