tree-optimization/96698 - fix ICE when vectorizing nested cycles
authorRichard Biener <rguenther@suse.de>
Wed, 26 Aug 2020 13:12:17 +0000 (15:12 +0200)
committerRichard Biener <rguenther@suse.de>
Wed, 26 Aug 2020 14:02:32 +0000 (16:02 +0200)
commit2130efe6ac7beba72d289e3dd145daa10aeaed54
tree9f9f63553ccafec89b413aea2df46de595dbf809
parent3eefb302d2bd8502cb3d8fe44e672b11092ccaf6
tree-optimization/96698 - fix ICE when vectorizing nested cycles

This fixes vectorized PHI latch edge updating and delay it until
all of the loop is code generated to deal with the case that the
latch def is a PHI in the same block.

2020-08-26  Richard Biener  <rguenther@suse.de>

PR tree-optimization/96698
* tree-vectorizer.h (loop_vec_info::reduc_latch_defs): New.
(loop_vec_info::reduc_latch_slp_defs): Likewise.
* tree-vect-stmts.c (vect_transform_stmt): Only record
stmts to update PHI latches from, perform the update ...
* tree-vect-loop.c (vect_transform_loop): ... here after
vectorizing those PHIs.
(info_for_reduction): Properly handle non-reduction PHIs.

* gcc.dg/vect/pr96698.c: New testcase.
gcc/testsuite/gcc.dg/vect/pr96698.c [new file with mode: 0644]
gcc/tree-vect-loop.c
gcc/tree-vect-stmts.c
gcc/tree-vectorizer.h