https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104152
Bug ID: 104152 Summary: ICE with -Ofast -march=armv8.2-a+sve -msve-vector-bits=scalable Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: gilles.gouaillardet at gmail dot com Target Milestone: --- Created attachment 52248 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52248&action=edit a simple reproducer The attached reproducer crashes with the trunk branch when -Ofast -march=armv8.2-a+sve -msve-vector-bits=scalable is used: FWIW, git bisect points to this commit: commit ce670e4faafb296d1f1a7828d20f8c8ba4686797 Author: Richard Biener <rguent...@suse.de> Date: Wed Nov 18 14:17:34 2020 +0100 tree-optimization/97832 - handle associatable chains in SLP discovery This makes SLP discovery handle associatable (including mixed plus/minus) chains better by swapping operands across the whole chain. To work this adds caching of the 'matches' lanes for failed SLP discovery attempts, thereby fixing a failed SLP discovery for the slp-pr98855.cc testcase which results in building an operand from scalars as expected. Unfortunately this makes us trip over the cost threshold so I'm XFAILing the testcase for now. For BB vectorization all this doesn't work because we have no way to distinguish good from bad associations as we eventually build operands from scalars and thus not fail in the classical sense. 2021-05-31 Richard Biener <rguent...@suse.de> PR tree-optimization/97832 * tree-vectorizer.h (_slp_tree::failed): New. * tree-vect-slp.c (_slp_tree::_slp_tree): Initialize failed member. (_slp_tree::~_slp_tree): Free failed. (vect_build_slp_tree): Retain failed nodes and record matches in them, copying that back out when running into a cached fail. Dump start and end of discovery. (dt_sort_cmp): New. (vect_build_slp_tree_2): Handle associatable chains together doing more aggressive operand swapping. * gcc.dg/vect/pr97832-1.c: New testcase. * gcc.dg/vect/pr97832-2.c: Likewise. * gcc.dg/vect/pr97832-3.c: Likewise. * g++.dg/vect/slp-pr98855.cc: XFAIL. Here is the stack trace in my environment: $ g++ -c -Ofast -march=armv8.2-a+sve -msve-vector-bits=scalable -c badaboum.cpp 2>&1 | tee badaboum.log during GIMPLE pass: vect badaboum.cpp: In function ?int badaboum(float*, float**)?: badaboum.cpp:20:5: internal compiler error: in duplicate_and_interleave, at tree-vect-slp.cc:6188 20 | int badaboum(rvec_ cm_mol, float **tc) | ^~~~~~~~ 0x136d3e7 duplicate_and_interleave(vec_info*, gimple**, tree_node*, vec<tree_node*, va_heap, vl_ptr> const&, unsigned int, vec<tree_node*, va_heap, vl_ptr>&) ../../../src/gcc-trunk/gcc/tree-vect-slp.cc:6188 0x136d89b vect_create_constant_vectors ../../../src/gcc-trunk/gcc/tree-vect-slp.cc:6409 0x136d89b vect_schedule_slp_node ../../../src/gcc-trunk/gcc/tree-vect-slp.cc:7114 0x137d363 vect_schedule_scc ../../../src/gcc-trunk/gcc/tree-vect-slp.cc:7426 0x137ddbf vect_schedule_scc ../../../src/gcc-trunk/gcc/tree-vect-slp.cc:7443 0x137ddbf vect_schedule_scc ../../../src/gcc-trunk/gcc/tree-vect-slp.cc:7443 0x137ddbf vect_schedule_scc ../../../src/gcc-trunk/gcc/tree-vect-slp.cc:7443 0x137ddbf vect_schedule_scc ../../../src/gcc-trunk/gcc/tree-vect-slp.cc:7443 0x137e60f vect_schedule_slp(vec_info*, vec<_slp_instance*, va_heap, vl_ptr> const&) ../../../src/gcc-trunk/gcc/tree-vect-slp.cc:7579 0x1355bc3 vect_transform_loop(_loop_vec_info*, gimple*) ../../../src/gcc-trunk/gcc/tree-vect-loop.cc:9753 0x138aa2b vect_transform_loops ../../../src/gcc-trunk/gcc/tree-vectorizer.cc:1003 0x138aa2b try_vectorize_loop_1 ../../../src/gcc-trunk/gcc/tree-vectorizer.cc:1133 0x138aa2b try_vectorize_loop ../../../src/gcc-trunk/gcc/tree-vectorizer.cc:1162 0x138b097 execute ../../../src/gcc-trunk/gcc/tree-vectorizer.cc:1278 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <https://gcc.gnu.org/bugs/> for instructions.