Go to file
David Malcolm 8b9a03d644 tree-if-conv.c: fix ICE seen with -fno-tree-forwprop (PR tree-optimization/84178)
PR tree-optimization/84178 reports a couple of source files that ICE inside
ifcvt when compiled with -03 -fno-tree-forwprop (trunk and gcc 7).

Both cases involve problems with ifcvt's per-BB gimplified predicates.

Testcase 1 fails this assertion within release_bb_predicate during cleanup:

283	      if (flag_checking)
284		for (gimple_stmt_iterator i = gsi_start (stmts);
285		     !gsi_end_p (i); gsi_next (&i))
286		  gcc_assert (! gimple_use_ops (gsi_stmt (i)));

The testcase contains a division in the loop, which leads to
if_convertible_loop_p returning false (due to gimple_could_trap_p being true
for the division).  This happens *after* the per-BB gimplified predicates
have been created in predicate_bbs (loop).
Hence tree_if_conversion bails out to "cleanup", but the gimplified predicates
exist and make use of SSA names; for example this conjunction for two BB
conditions:

  _4 = h4.1_112 != 0;
  _175 = (signed char) _117;
  _176 = _175 >= 0;
  _174 = _4 & _176;

is using SSA names.

This assertion was added in r236498 (aka c3deca2519d97c55876869c57cf11ae1e5c6cf8b):

    2016-05-20  Richard Biener  <rguenther@suse.de>

        * tree-if-conv.c (add_bb_predicate_gimplified_stmts): Use
        gimple_seq_add_seq_without_update.
        (release_bb_predicate): Assert we have no operands to free.
        (if_convertible_loop_p_1): Calculate post dominators later.
        Do not free BB predicates here.
        (combine_blocks): Do not recompute BB predicates.
        (version_loop_for_if_conversion): Save BB predicates around
        loop versioning.

        * gcc.dg/tree-ssa/ifc-cd.c: Adjust.

The following patch fixes this by adding a call to gimple_seq_discard
to release_bb_predicate.  It also updates the assertion, so that
instead of asserting the stmts have no imm uses, instead assert that
they weren't added to a bb before discarding them (otherwise discarding
them would be a bug).  We know this is the case because
insert_gimplified_predicates has:

	  /* Once the sequence is code generated, set it to NULL.  */
	  set_bb_predicate_gimplified_stmts (bb, NULL);

but asserting it seems appropriate as a double-check.

The patch doesn't address the 2nd issue within PR tree-optimization/84178.

gcc/ChangeLog:
	PR tree-optimization/84178
	* tree-if-conv.c (release_bb_predicate): Remove the
	the assertion that the stmts have NULL use_ops.
	Discard the statements, asserting that they haven't
	yet been added to a BB.

gcc/testsuite/ChangeLog:
	PR tree-optimization/84178
	* gcc.c-torture/compile/pr84178-1.c: New test.

From-SVN: r258363
2018-03-08 12:17:36 +00:00
config
contrib More Cilk Plus removal 2018-03-02 17:35:26 +01:00
fixincludes
gcc tree-if-conv.c: fix ICE seen with -fno-tree-forwprop (PR tree-optimization/84178) 2018-03-08 12:17:36 +00:00
gnattools
gotools
include
INSTALL
intl
libada
libatomic
libbacktrace
libcc1
libcpp * da.po: Update. 2018-03-03 18:55:20 +00:00
libdecnumber
libffi
libgcc fptr.c (_dl_read_access_allowed): New. 2018-03-07 00:17:32 +00:00
libgfortran
libgo runtime: push arena on AIX higher due to clashes 2018-03-07 15:22:46 +00:00
libgomp
libhsail-rt
libiberty libiberty: fix URL for demangler ABI 2018-03-02 20:20:37 +00:00
libitm
libmpx
libobjc
liboffloadmic
libquadmath
libsanitizer
libssp
libstdc++-v3 printers.py (NodeIteratorPrinter): New. 2018-03-08 06:26:15 +00:00
libvtv
lto-plugin
maintainer-scripts
zlib
.dir-locals.el
.gitattributes
.gitignore
ABOUT-NLS
ChangeLog
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
Makefile.def
Makefile.in
Makefile.tpl
missing
mkdep
mkinstalldirs
move-if-change
README
symlink-tree
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.