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);
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); }
Started with r222514.
Mine.
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.
As of trunk 20150520, this bug looks fixed to me.
It might be mitigated for the testcase in question but the underlying problem didn't get fixed.
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
Fixed.