[PATCH] D20315: [LV] For some induction variables, use vector phis instead of widening the scalar in the loop body
Michael Kuperstein via llvm-commits
llvm-commits at lists.llvm.org
Tue May 17 11:12:39 PDT 2016
mkuper added a comment.
Right, I'll add an explicit test (the test in induction_plus is *sort of* that, but not quite), thanks David!
Regarding the extra movdqa - I think the copy may be necessary.
The problem is that the loop body needs both to modify the current IV (because of two-address instructions) and keep it so that it can generate the new IV.
GCC does something similar:
jmp .L3
[...]
.L5:
movdqa %xmm4, %xmm1
.L3:
movdqa %xmm1, %xmm4
pxor %xmm6, %xmm1
movdqa %xmm5, %xmm2
addl $1, %eax
cmpl $250, %eax
paddd %xmm7, %xmm4
pcmpgtd %xmm1, %xmm2
movdqa %xmm1, %xmm3
punpckhdq %xmm2, %xmm1
punpckldq %xmm2, %xmm3
paddq %xmm3, %xmm0
paddq %xmm1, %xmm0
jne .L5
The difference is that the loop is rotated, so there is no copy on the first iteration, but other than that, we still have the same two movdqas per iteration.
In any case, the extra mov disappears once we have AVX and three-address instructions, so we no longer update the current IV destructively.
http://reviews.llvm.org/D20315
More information about the llvm-commits
mailing list