Richard Biener wrote:
Well. In this case we hit /* If one of the loop header's edge is an exit edge then do not apply if-conversion. */ FOR_EACH_EDGE (e, ei, loop->header->succs) if (loop_exit_edge_p (loop, e)) return false; which is simply because even after if-conversion we'll at least end up with a non-empty latch block which is what the vectorizer doesn't support. DOM rotated the loop into this non-canonical form. Running loop header copying again would probably undo this.
Indeed - header copying causes the loop to be if-converted, and then actually vectorized, too. (Well, I had to make do_while_loop_p a bit more aggressive in saying things weren't do-while loops.)
I merely moved pass_ch to immediately after pass_dominator, a few stages later; I have also tried cloning it, but do you foresee any problems with just moving it? (It passes bootstrap, I'm running the full testsuite atm).
Cheers, Alan