tree-optimization/96022 - fix ICE with vectorized shift
authorRichard Biener <rguenther@suse.de>
Thu, 2 Jul 2020 09:12:51 +0000 (11:12 +0200)
committerRichard Biener <rguenther@suse.de>
Thu, 2 Jul 2020 09:18:09 +0000 (11:18 +0200)
commitd5d9f7834ab809841c4ccc90bca74808b4bcaf8d
treea71e490d3d520f1c299df1563e823760c19c6382
parent5c9669a0e6cbf477a03024522943197bdb2682d4
tree-optimization/96022 - fix ICE with vectorized shift

This fixes lane extraction for internal def vectorized shifts
with an effective scalar shift operand by always using lane zero
of the first vector stmt.

It also fixes a SLP build issue noticed on the testcase where
we end up building unary vector ops with the only operand built
form scalars which isn't profitable by itself.  The exception
is for stores.

2020-07-02  Richard Biener  <rguenther@suse.de>

PR tree-optimization/96022
* tree-vect-stmts.c (vectorizable_shift): Only use the
first vector stmt when extracting the scalar shift amount.
* tree-vect-slp.c (vect_build_slp_tree_2): Also build unary
nodes with all-scalar children from scalars but not stores.
(vect_analyze_slp_instance): Mark the node not failed.

* g++.dg/vect/pr96022.cc: New testcase.
gcc/testsuite/g++.dg/vect/pr96022.cc [new file with mode: 0644]
gcc/tree-vect-slp.c
gcc/tree-vect-stmts.c