This patch moves the update instruction for vectorized integer induction phi nodes to the end of the latch block. This ensures consistent placement of all induction updates despite the kind of induction we create (scalar, splat vector, or vector phi).
I was comparing the IR, post-instcombine, we generate using the vector splat and vector phi methods of widening induction variables. The vector splat method keeps the original update we create at the end of the latch:
i = phi [0, pre-header], [i.next, latch] ... i.next = i + 1 cmp i.next br
whereas the vector phi method was generating code that simplifies to:
i = phi [0, pre-header], [i.next, latch] i.next = i + 1 ... cmp i.next br
with the update at the top of the header. This is because the original scalar update was being replaced by the new update during simplification. This is not a huge deal, but this patch ensures that for many cases, both methods can simplify to the same IR.
Let me know what you think.