Bug 65961 - [6 Regression] ice in vect_is_simple_use_1 with -O3
Summary: [6 Regression] ice in vect_is_simple_use_1 with -O3
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 6.0
: P3 normal
Target Milestone: 6.0
Assignee: Richard Biener
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-05-01 11:01 UTC by David Binderman
Modified: 2015-06-03 07:42 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2015-05-01 00:00:00


Attachments
C source code (7.35 KB, text/plain)
2015-05-01 11:01 UTC, David Binderman
Details

Note You need to log in before you can comment on or make changes to this bug.
Description David Binderman 2015-05-01 11:01:46 UTC
Created attachment 35435 [details]
C source code

The attached code, when compiled by gcc trunk dated 20150429
and with flag -O3, says this:

qshs.c: In function ‘shs1’:
qshs.c:136:1: internal compiler error: in vect_is_simple_use_1, at tree-vect-stmts.c:7867
0xdca504 vect_is_simple_use_1(tree_node*, gimple_statement_base*, _loop_vec_info*, _bb_vec_info*, gimple_statement_base**, tree_node**, vect_def_type*, tree_node**)
    ../../src/trunk/gcc/tree-vect-stmts.c:7867
0xdd3d5a vectorizable_operation
    ../../src/trunk/gcc/tree-vect-stmts.c:4676
0xddc731 vect_analyze_stmt(gimple_statement_base*, bool*, _slp_tree*)
    ../../src/trunk/gcc/tree-vect-stmts.c:7196
0xdf1319 vect_slp_analyze_node_operations
    ../../src/trunk/gcc/tree-vect-slp.c:2094

tree-vect-stmts.c:7867 is

    gcc_assert (*vectype != NULL_TREE);
Comment 1 Markus Trippelsdorf 2015-05-01 11:25:42 UTC
int *a;
void
foo ()
{
  do
    {
      a[16] = (a[1] ^ a[0]) << 1 | a[1];
      a[17] = (a[0] ^ a[1]) << 1 | a[0];
      a[18] = (a[0] ^ a[1]) << 1 | a[0];
      a[19] = (a[0] ^ a[1]) << 1 | a[0];
      a[20] = (a[0] ^ a[1]) << 1 | a[0];
      a[21] = (a[0] ^ a[1]) << 1 | a[0];
      a[22] = (a[0] ^ a[1]) << 1 | a[0];
      a[23] = (a[20] ^ a[1]) << 1 | a[9];
      a += 8;
    }
  while (1);
}
Comment 2 Marek Polacek 2015-05-04 10:54:53 UTC
Started with r222514.
Comment 3 Richard Biener 2015-05-04 11:21:43 UTC
Mine.
Comment 4 Richard Biener 2015-05-12 09:49:27 UTC
Hmpf, so we have an operand that is both part of a regular SLP node _and_ is part
of a SLP node that gets its operand built up from scalars.  So obviously
looking at STMT_VINFO_VECTORIZABLE (def-of-op) isn't giving the correct answer
(it depends on context).

I tried to avoid passing down the SLP node to vect_is_simple_use[_1], but that
is what it would take to fix this (well, or reject the SLP build while we compute
STMT_VINFO_VECTORIZABLE ()).

I have to think more about what refactoring would make sense here.
Comment 5 David Binderman 2015-05-20 06:54:15 UTC
As of trunk 20150520, this bug looks fixed to me.
Comment 6 Richard Biener 2015-05-20 07:38:37 UTC
It might be mitigated for the testcase in question but the underlying problem didn't get fixed.
Comment 7 Richard Biener 2015-06-02 07:50:50 UTC
Author: rguenth
Date: Tue Jun  2 07:50:19 2015
New Revision: 224013

URL: https://gcc.gnu.org/viewcvs?rev=224013&root=gcc&view=rev
Log:
2015-06-02  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/65961
	* tree-vect-slp.c (vect_get_and_check_slp_defs): Remove bogus
	check and clarify dump message.
	(vect_build_slp_tree): If all children are built up from scalars
	build up the parent from scalars instead.
	* tree-vect-stmts.c (vect_is_simple_use): Cleanup.

	* gcc.dg/torture/pr65961.c: New testcase.

Added:
    trunk/gcc/testsuite/gcc.dg/torture/pr65961.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-vect-slp.c
    trunk/gcc/tree-vect-stmts.c
Comment 8 Richard Biener 2015-06-03 07:42:50 UTC
Fixed.