]> git.ipfire.org Git - thirdparty/gcc.git/commit
vect: Avoid duplicate_and_interleave for uniform vectors [PR112661]
authorRichard Sandiford <richard.sandiford@arm.com>
Mon, 27 Nov 2023 13:38:16 +0000 (13:38 +0000)
committerRichard Sandiford <richard.sandiford@arm.com>
Mon, 27 Nov 2023 13:38:16 +0000 (13:38 +0000)
commit061a82fa2b751b42d0d8ddfcd45367c848d3ee64
tree5dcbf2e93a40b610c34dade0e88cf7b09c79574e
parent5b33cf3a3a2025a4856f90fea8bd04884c2f6b31
vect: Avoid duplicate_and_interleave for uniform vectors [PR112661]

can_duplicate_and_interleave_p checks whether we know a way of
building a particular VLA SLP invariant.  g:60034ecf25597bd515f
skipped that test for booleans, to support MASK_LEN_GATHER_LOAD
calls with a dummy all-ones mask.  But there's nothing fundamentally
different about VLA masks vs VLA data vectors.  If we have a VLA mask
that isn't all-ones, we need some way of loading it.  This ultimately
led to the ICE in the PR.

This patch fixes it by applying can_duplicate_and_interleave_p
to masks, while also adding a special path for uniform vectors
(of all kinds) to support the MASK_LEN_GATHER_LOAD usage.  This
also fixes an XFAIL in pr36648.cc for SVE.

The patch is mostly Richard's.  My only changes were to skip
redundant conversions and to use gimple_build_vector_from_val
for all eligible vectors.

2023-11-27  Richard Biener  <rguenther@suse.de>
    Richard Sandiford  <richard.sandiford@arm.com>

gcc/
PR tree-optimization/112661
* tree-vect-slp.cc (vect_get_and_check_slp_defs): Defer duplicate-and-
interleave test to...
(vect_build_slp_tree_2): ...here, once we have all the operands.
Skip the test for uniform vectors.
(vect_create_constant_vectors): Detect uniform vectors.  Avoid
redundant conversions in that case.  Use gimple_build_vector_from_val
to build the vector.

gcc/testsuite/
* g++.dg/vect/pr36648.cc: Remove XFAIL for VLA load-lanes.
gcc/testsuite/g++.dg/vect/pr36648.cc
gcc/tree-vect-slp.cc