Two fixes for live-out SLP inductions (PR 83857)
commit7feaafa27d47d50ed3d199b5f22e56f4fc5c34bc
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 16 Jan 2018 15:13:32 +0000 (16 15:13 +0000)
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 16 Jan 2018 15:13:32 +0000 (16 15:13 +0000)
tree202d41236e118c3135fd0ed5979c117e2ca2e0dd
parent0f52440dfec99df847f84b607e8a7d57ec5abcd3
Two fixes for live-out SLP inductions (PR 83857)

vect_analyze_loop_operations was calling vectorizable_live_operation
for all live-out phis, which led to a bogus ncopies calculation in
the pure SLP case.  I think v_a_l_o should only be passing phis
that are vectorised using normal loop vectorisation, since
vect_slp_analyze_node_operations handles the SLP side (and knows
the correct slp_index and slp_node arguments to pass in, via
vect_analyze_stmt).

With that fixed we hit an older bug that vectorizable_live_operation
didn't handle live-out SLP inductions.  Fixed by using gimple_phi_result
rather than gimple_get_lhs for phis.

2018-01-16  Richard Sandiford  <richard.sandiford@linaro.org>

gcc/
PR tree-optimization/83857
* tree-vect-loop.c (vect_analyze_loop_operations): Don't call
vectorizable_live_operation for pure SLP statements.
(vectorizable_live_operation): Handle PHIs.

gcc/testsuite/
PR tree-optimization/83857
* gcc.dg/vect/pr83857.c: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@256747 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/vect/pr83857.c [new file with mode: 0644]
gcc/tree-vect-loop.c