Go to file
Richard Biener eca04dc855 tree-optimization/104658 - avoid mixing mask & non-mask vector defs
When pattern recognition fails to sanitize all defs of a mask
producing operation and the respective def is external or constant
we end up trying to produce a VECTOR_BOOLEAN_TYPE_P constructor
which in turn ends up exposing stmts like

  <signed-boolean:1> _135 = _49 ? -1 : 0;

which isn't handled well in followup SLP and generates awful code.

We do rely heavily on pattern recognition to sanitize mask vs.
data uses of bools but that fails here which means we also should
fail vectorization.  That avoids ICEing because of such stmts
and it also avoids generating weird code which makes the
vectorization not profitable.

The following patch simply disallows external VECTOR_BOOLEAN_TYPE_P
defs and arranges the promote to external code to instead promote
mask uses to extern (that's just a short-cut here).

I've also looked at aarch64 and with SVE and a fixed vector length
for the gcc.target/i386/pr101636.c testcase.  I see similar vectorization
(using <signed-boolean:4>) there but it's hard to decide whether the
old, the new or no vectorization is better for this.  The code
generated with traditional integer masks isn't as awkward but we
still get the != 0 promotion done for each scalar element which
doesn't look like intended - this operation should be visible upfront.

That also means some cases will now become a missed optimization
that needs to be fixed by bool pattern recognition.  But that can
possibly be delayed to GCC 13.

2022-02-22  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/104658
	* tree-vect-slp.cc (vect_slp_convert_to_external): Do not
	create VECTOR_BOOLEAN_TYPE_P extern defs.  Reset the vector
	type on nodes we promote.
	(vectorizable_bb_reduc_epilogue): Deal with externalized
	root.
	* tree-vect-stmts.cc (vect_maybe_update_slp_op_vectype): Do
	not allow VECTOR_BOOLEAN_TYPE_P extern defs.

	* gcc.target/i386/pr104658.c: New testcase.
2022-05-04 15:12:28 +02:00
c++tools
config Daily bump. 2022-05-04 00:16:24 +00:00
contrib Daily bump. 2022-04-29 00:16:26 +00:00
fixincludes
gcc tree-optimization/104658 - avoid mixing mask & non-mask vector defs 2022-05-04 15:12:28 +02:00
gnattools
gotools
include LTO plugin: modernize a bit. 2022-05-04 08:20:13 +02:00
INSTALL
intl
libada
libatomic
libbacktrace
libcc1
libcody
libcpp
libdecnumber
libffi
libgcc Daily bump. 2022-05-03 00:16:25 +00:00
libgfortran
libgo runtime: use correct field name for PPC32 GLIBC registers 2022-04-20 17:49:44 -07:00
libgomp Daily bump. 2022-05-04 00:16:24 +00:00
libiberty
libitm
libobjc
liboffloadmic
libphobos Daily bump. 2022-04-29 00:16:26 +00:00
libquadmath
libsanitizer libsanitizer: Update Makefile.am files. 2022-05-04 11:00:53 +02:00
libssp
libstdc++-v3 Daily bump. 2022-05-04 00:16:24 +00:00
libvtv
lto-plugin LTO plugin: modernize a bit. 2022-05-04 08:20:13 +02:00
maintainer-scripts Daily bump. 2022-04-29 00:16:26 +00:00
zlib
.dir-locals.el
.gitattributes
.gitignore
ABOUT-NLS
ar-lib
ChangeLog Daily bump. 2022-04-20 00:16:26 +00:00
ChangeLog.jit
ChangeLog.tree-ssa
compile
config-ml.in
config.guess
config.rpath
config.sub
configure
configure.ac
COPYING
COPYING3
COPYING3.LIB
COPYING.LIB
COPYING.RUNTIME
depcomp
install-sh
libtool-ldflags
libtool.m4
lt~obsolete.m4
ltgcc.m4
ltmain.sh
ltoptions.m4
ltsugar.m4
ltversion.m4
MAINTAINERS MAINTAINERS: Update my email address. 2022-04-19 10:29:15 -07:00
Makefile.def
Makefile.in
Makefile.tpl
missing
mkdep
mkinstalldirs
move-if-change
multilib.am
README
symlink-tree
test-driver
ylwrap

This directory contains the GNU Compiler Collection (GCC).

The GNU Compiler Collection is free software.  See the files whose
names start with COPYING for copying permission.  The manuals, and
some of the runtime libraries, are under different terms; see the
individual source files for details.

The directory INSTALL contains copies of the installation information
as HTML and plain text.  The source of this information is
gcc/doc/install.texi.  The installation information includes details
of what is included in the GCC sources and what files GCC installs.

See the file gcc/doc/gcc.texi (together with other files that it
includes) for usage and porting information.  An online readable
version of the manual is in the files gcc/doc/gcc.info*.

See http://gcc.gnu.org/bugs/ for how to report bugs usefully.

Copyright years on GCC source files may be listed using range
notation, e.g., 1987-2012, indicating that every year in the range,
inclusive, is a copyrightable year that could otherwise be listed
individually.