Go to file
Jakub Jelinek 345dffd0d4 generic-match-head: Don't assume GENERIC folding is done only early [PR108237]
We ICE on the following testcase, because a valid V2DImode
!= comparison is folded into an unsupported V2DImode > comparison.
The match.pd pattern which does this looks like:
/* Transform comparisons of the form (X & Y) CMP 0 to X CMP2 Z
   where ~Y + 1 == pow2 and Z = ~Y.  */
(for cst (VECTOR_CST INTEGER_CST)
 (for cmp (eq ne)
      icmp (le gt)
  (simplify
   (cmp (bit_and:c@2 @0 cst@1) integer_zerop)
    (with { tree csts = bitmask_inv_cst_vector_p (@1); }
     (if (csts && (VECTOR_TYPE_P (TREE_TYPE (@1)) || single_use (@2)))
      (with { auto optab = VECTOR_TYPE_P (TREE_TYPE (@1))
                         ? optab_vector : optab_default;
              tree utype = unsigned_type_for (TREE_TYPE (@1)); }
       (if (target_supports_op_p (utype, icmp, optab)
            || (optimize_vectors_before_lowering_p ()
                && (!target_supports_op_p (type, cmp, optab)
                    || !target_supports_op_p (type, BIT_AND_EXPR, optab))))
        (if (TYPE_UNSIGNED (TREE_TYPE (@1)))
         (icmp @0 { csts; })
         (icmp (view_convert:utype @0) { csts; })))))))))
and that optimize_vectors_before_lowering_p () guarded stuff there
already deals with this problem, not trying to fold a supported comparison
into a non-supported one.  The reason it doesn't work in this case is that
it isn't GIMPLE folding which does this, but GENERIC folding done during
forwprop4 - forward_propagate_into_comparison -> forward_propagate_into_comparison_1
-> combine_cond_expr_cond -> fold_binary_loc -> generic_simplify
and we simply assumed that GENERIC folding happens only before
gimplification.

The following patch fixes that by checking cfun properties instead of
always returning true in those cases.

2023-01-04  Jakub Jelinek  <jakub@redhat.com>

	PR middle-end/108237
	* generic-match-head.cc: Include tree-pass.h.
	(canonicalize_math_p, optimize_vectors_before_lowering_p): Define
	to false if cfun and cfun->curr_properties has PROP_gimple_opt_math
	resp. PROP_gimple_lvec property set.

	* gcc.c-torture/compile/pr108237.c: New test.
2023-01-04 10:54:38 +01:00
c++tools Update copyright years. 2023-01-02 09:40:19 +01:00
config Daily bump. 2022-11-15 08:32:29 +00:00
contrib Daily bump. 2022-12-29 00:17:39 +00:00
fixincludes Daily bump. 2022-11-24 00:17:47 +00:00
gcc generic-match-head: Don't assume GENERIC folding is done only early [PR108237] 2023-01-04 10:54:38 +01:00
gnattools Daily bump. 2022-09-01 00:17:39 +00:00
gotools Daily bump. 2022-08-31 00:16:45 +00:00
include Daily bump. 2022-12-22 00:17:29 +00:00
INSTALL
intl Daily bump. 2022-11-24 00:17:47 +00:00
libada Update Copyright year in ChangeLog files 2023-01-02 09:23:36 +01:00
libatomic Update Copyright year in ChangeLog files 2023-01-02 09:23:36 +01:00
libbacktrace Update Copyright year in ChangeLog files 2023-01-02 09:23:36 +01:00
libcc1 Daily bump. 2022-11-02 00:17:38 +00:00
libcody Update Copyright year in ChangeLog files 2023-01-02 09:23:36 +01:00
libcpp Update Copyright year in ChangeLog files 2023-01-02 09:23:36 +01:00
libdecnumber Update Copyright year in ChangeLog files 2023-01-02 09:23:36 +01:00
libffi Daily bump. 2022-12-22 00:17:29 +00:00
libgcc Daily bump. 2023-01-04 00:17:22 +00:00
libgfortran Rotate ChangeLog files. 2023-01-01 16:20:13 +01:00
libgm2 Daily bump. 2023-01-01 00:17:17 +00:00
libgo libgo: check for makecontext in -lucontext 2022-12-20 19:34:55 -08:00
libgomp Daily bump. 2023-01-03 00:17:09 +00:00
libiberty Daily bump. 2022-11-24 00:17:47 +00:00
libitm Daily bump. 2023-01-03 00:17:09 +00:00
libobjc Update Copyright year in ChangeLog files 2023-01-02 09:23:36 +01:00
libphobos Update Copyright year in ChangeLog files 2023-01-02 09:23:36 +01:00
libquadmath Daily bump. 2023-01-03 00:17:09 +00:00
libsanitizer Daily bump. 2022-12-20 00:17:00 +00:00
libssp Daily bump. 2022-10-13 00:17:37 +00:00
libstdc++-v3 Rotate ChangeLog files. 2023-01-01 16:20:13 +01:00
libvtv changelog: Fix extra space after tab. 2022-11-21 10:13:44 +01:00
lto-plugin Daily bump. 2022-11-24 00:17:47 +00:00
maintainer-scripts Daily bump. 2022-12-01 00:17:51 +00:00
zlib Daily bump. 2022-11-24 00:17:47 +00:00
.dir-locals.el
.gitattributes
.gitignore .gitignore: do not ignore config.h 2022-07-19 17:07:04 +03:00
ABOUT-NLS
ar-lib
ChangeLog Daily bump. 2023-01-01 00:17:17 +00:00
ChangeLog.jit
ChangeLog.tree-ssa
compile
config-ml.in
config.guess
config.rpath
config.sub config.sub: change mode to 755. 2021-12-21 09:10:57 +01:00
configure [PATCH] Use toplevel configure for GMP and MPFR for gdb 2022-12-21 17:18:53 +00:00
configure.ac [PATCH] Use toplevel configure for GMP and MPFR for gdb 2022-12-21 17:18:53 +00:00
COPYING
COPYING3
COPYING3.LIB
COPYING.LIB
COPYING.RUNTIME
depcomp
install-sh
libtool-ldflags
libtool.m4 Generic configury support for shared libs on VxWorks 2022-10-11 07:31:07 +00:00
lt~obsolete.m4
ltgcc.m4
ltmain.sh
ltoptions.m4
ltsugar.m4
ltversion.m4
MAINTAINERS MAINTAINERS: fix spacing 2022-12-09 11:08:55 +01:00
Makefile.def configure: Do not build the ununsed libffi shared library. 2022-12-31 17:51:47 +00:00
Makefile.in configure: Do not build the ununsed libffi shared library. 2022-12-31 17:51:47 +00:00
Makefile.tpl Merge modula-2 front end onto gcc. 2022-12-14 17:43:08 +00:00
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.