While compiling the GCC testsuite testcase gcc.target/aarch64/vect-fmax-fmin.c with aarch64 crosscompiler: aarch64-linux-gnu-gcc /home/worker/buildworker/tiber-option-juggler/build/gcc/testsuite/gcc.target/aarch64/vect-fmax-fmin.c -fno-tree-loop-vectorize -Ofast An ICE occurs: during GIMPLE pass: slp In file included from /home/worker/buildworker/tiber-option-juggler/build/gcc/testsuite/gcc.target/aarch64/vect-fmax-fmin.c:8: /home/worker/buildworker/tiber-option-juggler/build/gcc/testsuite/gcc.target/aarch64/vect-fmaxv-fminv.x: In function ‘maxv_f32’: /home/worker/buildworker/tiber-option-juggler/build/gcc/testsuite/gcc.target/aarch64/vect-fmaxv-fminv.x:5:7: internal compiler error: Segmentation fault 5 | float maxv_f32 (pRF32 a) | ^~~~~~~~ 0xd938df crash_signal /home/worker/buildworker/tiber-gcc-trunk-aarch64/build/gcc/toplev.cc:316 0xa7e033 gimple_convert(gimple_stmt_iterator*, bool, gsi_iterator_update, unsigned int, tree_node*, tree_node*) /home/worker/buildworker/tiber-gcc-trunk-aarch64/build/gcc/gimple-fold.cc:9168 0x10274cf gimple_convert(gimple**, tree_node*, tree_node*) /home/worker/buildworker/tiber-gcc-trunk-aarch64/build/gcc/gimple-fold.h:183 0x10274cf vectorize_slp_instance_root_stmt(_slp_tree*, _slp_instance*) /home/worker/buildworker/tiber-gcc-trunk-aarch64/build/gcc/tree-vect-slp.cc:9401 0x10287aa vect_schedule_slp(vec_info*, vec<_slp_instance*, va_heap, vl_ptr> const&) /home/worker/buildworker/tiber-gcc-trunk-aarch64/build/gcc/tree-vect-slp.cc:9639 0x102ac51 vect_slp_region /home/worker/buildworker/tiber-gcc-trunk-aarch64/build/gcc/tree-vect-slp.cc:7770 0x102c19c vect_slp_bbs /home/worker/buildworker/tiber-gcc-trunk-aarch64/build/gcc/tree-vect-slp.cc:7870 0x102c688 vect_slp_function(function*) /home/worker/buildworker/tiber-gcc-trunk-aarch64/build/gcc/tree-vect-slp.cc:7992 0x1033f59 execute /home/worker/buildworker/tiber-gcc-trunk-aarch64/build/gcc/tree-vectorizer.cc:1531 Please submit a full bug report, with preprocessed source (by using -freport-bug). Please include the complete backtrace with any bug report. See <https://gcc.gnu.org/bugs/> for instructions. My guess is that the segmentation fault is caused by SLP passing a null tree to gimple_convert.
I will have a look.
OK, so we're running into /* When a BB reduction doesn't have an even number of lanes strip it down, treating the remaining lane as scalar. ??? Selecting the optimal set of lanes to vectorize would be nice but SLP build for all lanes will fail quickly because we think we're going to need unrolling. */ if (kind == slp_inst_kind_bb_reduc && (scalar_stmts.length () & 1)) remain.safe_insert (0, gimple_get_lhs (scalar_stmts.pop ()->stmt)); pushing the "LHS" of an asm. __asm__("" : "=w" s_10 : "0" _1);
The master branch has been updated by Richard Biener <rguenth@gcc.gnu.org>: https://gcc.gnu.org/g:4e9b2c94e45f5991a472fb639fb2baa6aa42b76b commit r14-6552-g4e9b2c94e45f5991a472fb639fb2baa6aa42b76b Author: Richard Biener <rguenther@suse.de> Date: Thu Dec 14 16:00:50 2023 +0100 tree-optimization/113018 - ICE with BB reduction vectorization When BB reduction vectorization picks up a chain with an ASM def in it and that's inside the vectorized region we fail to get its LHS. Instead of trying to get the correct def the following avoids vectorizing such def and instead keeps it as def to add in the epilog. PR tree-optimization/113018 * tree-vect-slp.cc (vect_slp_check_for_roots): Only start SLP discovery from stmts with a LHS.
Fixed.