Created attachment 35622 [details] preprocessed reproduction file Hitting an internal compilation error for the attached repro.i file. g++ -c -std=c++98 -pedantic -Wno-long-long -fwrapv -fPIC -O3 -fno-loop-optimize repro.i dtodoublessingleststscript4.cpp: In function ‘void dtodoublessingleststscript4(short int, const cint16_T*, short int*, cint16_T*, int*, cint32_T*, cint32_T*, int*, cint32_T*, cint16_T*, cint32_T*, int*, int*, cint32_T*, cint32_T*, int*, cint32_T*, int*, int*, cint32_T*, cint32_T*, cint16_T*, short int*, short int*, short int*, short int*)’: dtodoublessingleststscript4.cpp:102:6: internal compiler error: in vect_get_vec_def_for_operand, at tree-vect-stmts.c:1322 Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions. I am seeing this on a Debian 7 machine. g++ -v Using built-in specs. COLLECT_GCC=g++ COLLECT_LTO_WRAPPER=/SNIP/glnxa64/gcc-4.7.2/libexec/gcc/x86_64-unknown-linux-gnu/4.7.2/lto-wrapper Target: x86_64-unknown-linux-gnu Configured with: /SNIP/gcc-4.7/configure --prefix=/SNIP/glnxa64/gcc-4.7.2 --with-gmp=/SNIP/glnxa64/gcc-4.7/gmp --with-mpfr=/SNIP/glnxa64/gcc-4.7/mpfr --with-mpc=/SNIP/glnxa64/gcc-4.7/mpc --enable-languages=c,c++,fortran --with-as=/SNIP/glnxa64/gcc-4.7.2/bin/as --with-ld=/SNIP/glnxa64/gcc-4.7.2/bin/ld Thread model: posix gcc version 4.7.2 (GCC)
markus@x4 tmp % cat repro.ii typedef struct { short re; short im; } cint16_T; typedef struct { int re; int im; } cint32_T; int a; short b; cint16_T *c; cint32_T *d, *e; void fn1 () { for (; a; a++) { d[a].re = d[a].im = e[a].re = c[a].re * b; e[a].im = c[a].im * b; } } markus@x4 tmp % g++ -c -O3 repro.ii repro.ii: In function ‘void fn1()’: repro.ii:16:1: internal compiler error: in vect_get_vec_def_for_operand, at tree-vect-stmts.c:1472 fn1 () ^ 0xe98c19 vect_get_vec_def_for_operand(tree_node*, gimple_statement_base*, tree_node**) ../../gcc/gcc/tree-vect-stmts.c:1472 0xea1273 vectorizable_store ../../gcc/gcc/tree-vect-stmts.c:5330 0xeab8f0 vect_transform_stmt(gimple_statement_base*, gimple_stmt_iterator*, bool*, _slp_tree*, _slp_instance*) ../../gcc/gcc/tree-vect-stmts.c:7345 0xeb0d84 vect_transform_loop(_loop_vec_info*) ../../gcc/gcc/tree-vect-loop.c:6185 0xecbe82 vectorize_loops() ../../gcc/gcc/tree-vectorizer.c:502 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <http://gcc.gnu.org/bugs.html> for instructions.
repro.ii: In function ‘void fn1()’: repro.ii:16:1: error: definition in block 7 follows the use fn1 () ^ for SSA_NAME: vect_patt_56.19_117 in statement: vect_inter_high_132 = VEC_PERM_EXPR <vect_patt_56.19_117, vect_patt_56.19_117, { 0, 4, 1, 5 }>; repro.ii:16:1: internal compiler error: verify_ssa failed 0xe77f79 verify_ssa(bool, bool) ../../gcc/gcc/tree-ssa.c:1068 0xbcfee5 execute_function_todo ../../gcc/gcc/passes.c:1953 0xbd06d3 execute_todo ../../gcc/gcc/passes.c:2003 Please submit a full bug report, with preprocessed source if appropriate.
Started with r172817.
I will have a look.
Related to PR66251 (partial backport fixes the gcc 5 branch). On trunk the issue is that we have a SLP node node stmt 0 _9->re = _17; stmt 1 _9->im = _23; node stmt 0 patt_56 = _13 w* pretmp_51; stmt 1 patt_27 = _21 w* pretmp_51; node stmt 0 _13 = _12->re; stmt 1 _21 = _12->im; and non-SLP stores: # a.0_31 = PHI <a.0_29(22), a.5_25(7)> _5 = (long unsigned int) a.0_31; _6 = _5 * 8; _7 = pretmp_45 + _6; _9 = pretmp_47 + _6; _11 = _5 * 4; _12 = pretmp_49 + _11; _13 = _12->re; _14 = (int) _13; _17 = _14 * pretmp_53; _9->re = _17; _7->im = _17; _7->re = _17; _21 = _12->im; _22 = (int) _21; _23 = _22 * pretmp_53; _9->im = _23; a.5_25 = a.0_31 + 1; if (a.5_25 == 0) where the stored values and thus the vector stmts are shared. For the SLP scheduling we insert stmts before the last scalar use - in this case _9->im = _23 - and this includes the computation of _17 as the result is just {_17, _23}. But then regular vectorization comes along and inserts the required permutes at the place of the _7->{re,im} stores. I can't see how the old placement method avoided all the issues in similar situations. Well, it inserted stmts before the first stmt in a group (apart from stores where it chooses the last and loads where it chooses the first stmt). So with _9->re = _23; and _9->im = _17; it would have been broken there as well. Ah, no, on the GCC 5 branch we then simply fail to detect the SLP opportunity... typedef struct { short re; short im; } cint16_T; typedef struct { int re; int im; } cint32_T; int a; short b; cint16_T *c; cint32_T *d, *e; void fn1 () { for (; a; a++) { d[a].re = d[a].im = e[a].im = c[a].im * b; e[a].re = c[a].re * b; } } even after the backport (and on trunk) ICEs in vect_get_vec_def_for_operand
Which shows a bug in hybrid SLP detection.
Which also fixes the original testcase on trunk!
Author: rguenth Date: Mon Jun 1 10:37:30 2015 New Revision: 223927 URL: https://gcc.gnu.org/viewcvs?rev=223927&root=gcc&view=rev Log: 2015-06-01 Richard Biener <rguenther@suse.de> PR tree-optimization/66280 * tree-vect-slp.c (vect_detect_hybrid_slp_stmts): Fix pattern def-use walking. * g++.dg/torture/pr66280.C: New testcase. * g++.dg/torture/pr66280-2.C: Likewise. Added: trunk/gcc/testsuite/g++.dg/torture/pr66280-2.C trunk/gcc/testsuite/g++.dg/torture/pr66280.C Modified: trunk/gcc/ChangeLog trunk/gcc/testsuite/ChangeLog trunk/gcc/tree-vect-slp.c
Fixed on trunk sofar.
Author: rguenth Date: Wed Jun 3 07:39:06 2015 New Revision: 224059 URL: https://gcc.gnu.org/viewcvs?rev=224059&root=gcc&view=rev Log: 2015-06-03 Richard Biener <rguenther@suse.de> Backport from mainline 2015-06-02 Richard Biener <rguenther@suse.de> PR debug/65549 * dwarf2out.c (lookup_context_die): New function. (resolve_addr): Avoid forcing a full DIE for the target of a DW_TAG_GNU_call_site during late compilation. Instead create a stub DIE without a type if we have a context DIE present. * g++.dg/lto/pr65549_0.C: New testcase. 2015-06-01 Richard Biener <rguenther@suse.de> PR tree-optimization/66280 * tree-vect-slp.c (vect_detect_hybrid_slp_stmts): Fix pattern def-use walking. * g++.dg/torture/pr66280.C: New testcase. * g++.dg/torture/pr66280-2.C: Likewise. 2015-05-27 Richard Biener <rguenther@suse.de> PR tree-optimization/66272 Revert parts of 2014-08-15 Richard Biener <rguenther@suse.de> PR tree-optimization/62031 * tree-data-ref.c (dr_analyze_indices): Do not set DR_UNCONSTRAINED_BASE. (dr_may_alias_p): All indirect accesses have to go the formerly DR_UNCONSTRAINED_BASE path. * tree-data-ref.h (struct indices): Remove unconstrained_base member. (DR_UNCONSTRAINED_BASE): Remove. * gcc.dg/torture/pr66272.c: New testcase. 2015-05-21 Richard Biener <rguenther@suse.de> PR c++/66211 * match.pd: Guard pattern optimzing (int)(float)int conversions to apply only on GIMPLE. * g++.dg/conversion/pr66211.C: New testcase. * gcc.dg/tree-ssa/forwprop-18.c: Adjust. 2015-05-13 Richard Biener <rguenther@suse.de> PR tree-optimization/66123 * tree-ssa-dom.c (propagate_rhs_into_lhs): Check if we found a taken edge. * gcc.dg/torture/pr66123.c: New testcase. Added: branches/gcc-5-branch/gcc/testsuite/g++.dg/conversion/pr66211.C branches/gcc-5-branch/gcc/testsuite/g++.dg/lto/pr65549_0.C branches/gcc-5-branch/gcc/testsuite/g++.dg/torture/pr66280-2.C branches/gcc-5-branch/gcc/testsuite/g++.dg/torture/pr66280.C branches/gcc-5-branch/gcc/testsuite/gcc.dg/torture/pr66123.c branches/gcc-5-branch/gcc/testsuite/gcc.dg/torture/pr66272.c Modified: branches/gcc-5-branch/gcc/ChangeLog branches/gcc-5-branch/gcc/dwarf2out.c branches/gcc-5-branch/gcc/match.pd branches/gcc-5-branch/gcc/testsuite/ChangeLog branches/gcc-5-branch/gcc/testsuite/gcc.dg/tree-ssa/forwprop-18.c branches/gcc-5-branch/gcc/tree-data-ref.c branches/gcc-5-branch/gcc/tree-data-ref.h branches/gcc-5-branch/gcc/tree-ssa-dom.c branches/gcc-5-branch/gcc/tree-vect-slp.c
(In reply to Richard Biener from comment #9) > Fixed on trunk sofar. I still see this (or a very similar) error from the Fortran front-end at r224364: [sfilippo@epsilon NewPSBLAS]$ gfortran -v Using built-in specs. COLLECT_GCC=gfortran COLLECT_LTO_WRAPPER=/opt/gnu/6.0.0/libexec/gcc/x86_64-unknown-linux-gnu/6.0.0/lto-wrapper Target: x86_64-unknown-linux-gnu Configured with: ../gcc/configure --prefix=/opt/gnu/6.0.0 --enable-languages=c,c++,fortran --with-gmp=/usr/local/travel/GNU/gmp --with-mpfr=/usr/local/travel/GNU/mpfr --with-mpc=/usr/local/travel/GNU/mpc --with-isl=/usr/local/travel/GNU/isl Thread model: posix gcc version 6.0.0 20150611 (experimental) (GCC) [sfilippo@epsilon NewPSBLAS]$ gfortran -O3 -c mv.f90 mv.f90:1:0: subroutine mv(m,n,nc,alpha,irp,ja,val,& ^ internal compiler error: in vect_get_vec_def_for_operand, at tree-vect-stmts.c:1478 0xdbc689 vect_get_vec_def_for_operand(tree_node*, gimple_statement_base*, tree_node**) ../../gcc/gcc/tree-vect-stmts.c:1478 0xdc4ebc vectorizable_store ../../gcc/gcc/tree-vect-stmts.c:5330 0xdcfba6 vect_transform_stmt(gimple_statement_base*, gimple_stmt_iterator*, bool*, _slp_tree*, _slp_instance*) ../../gcc/gcc/tree-vect-stmts.c:7496 0xde90d5 vect_schedule_slp_instance ../../gcc/gcc/tree-vect-slp.c:3481 0xde96c6 vect_schedule_slp(_loop_vec_info*, _bb_vec_info*) ../../gcc/gcc/tree-vect-slp.c:3551 0xdd4bf7 vect_transform_loop(_loop_vec_info*) ../../gcc/gcc/tree-vect-loop.c:6218 0xdef242 vectorize_loops() ../../gcc/gcc/tree-vectorizer.c:495 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <http://gcc.gnu.org/bugs.html> for instructions. Salvatore
Created attachment 35763 [details] test case
(In reply to Salvatore Filippone from comment #12) > Created attachment 35763 [details] > test case Confirmed - though more like PR66251. This issue seems to be present in most of the vectorizable_* routines. Ah, no, the strided store support uses a wrong idiom for getting at vectorized stmts for SLP.
Backporting the fix from comment#8 to the 4.9 branch makes us run into PR64829. spawn /home/abuild/rguenther/gcc49-g/gcc/xgcc -B/home/abuild/rguenther/gcc49-g/gcc/ /space/rguenther/src/svn/gcc-4_9-branch/gcc/testsuite/gcc.dg/vect/slp-widen-mult-half.c -fno-diagnostics-show-caret -fdiagnostics-color=never -msse2 -ftree-vectorize -fno-vect-cost-model -fno-common -O2 -fdump-tree-vect-details -lm -march=native -o ./slp-widen-mult-half.exe^M /space/rguenther/src/svn/gcc-4_9-branch/gcc/testsuite/gcc.dg/vect/slp-widen-mult-half.c: In function 'foo':^M /space/rguenther/src/svn/gcc-4_9-branch/gcc/testsuite/gcc.dg/vect/slp-widen-mult-half.c:15:1: internal compiler error: in vect_detect_hybrid_slp_stmts, at tree-vect-slp.c:1790^M 0xdff124 vect_detect_hybrid_slp_stmts^M /space/rguenther/src/svn/gcc-4_9-branch/gcc/tree-vect-slp.c:1790^M 0xdff2d7 vect_detect_hybrid_slp_stmts^M /space/rguenther/src/svn/gcc-4_9-branch/gcc/tree-vect-slp.c:1815^M 0xdff2d7 vect_detect_hybrid_slp_stmts^M ... while we could simply remove the assert from the backport I think that is not a good idea (well, strictly speaking we need to adjust the stmt walking for that "bug") Backporting the fix for PR64829 is non-trivial due to unrelated changes. So I am at the moment not considering backports to 4.9 (and it's too late for 4.8).
Created attachment 35791 [details] Simple C testcase that fails on aarch64-elf (trunk r224528) The attached fails for me on trunk with aarch64-elf. Looks like the same problem, but possibly more reduced.
The gcc-4_8-branch is being closed, re-targeting regressions to 4.9.3.
GCC 4.9.3 has been released.
Fixed for 5.2, backport to 4.9 too involved.