Compiler Explorer: https://gcc.godbolt.org/z/nTjnh73xj The crash triggering program (compile with `gcc-14 -O3`): ``` short int w9; struct T { short a : 14; int b; }; struct T v; void __attribute__((simd)) zc() { w9 *= v.b ? v.a-- < 0 : 0; } ``` The crash output: ``` during GIMPLE pass: vect <source>: In function 'zc.simdclone.0': <source>:7:28: internal compiler error: in build_vector_from_val, at tree.cc:2104 7 | void __attribute__((simd)) zc() { | ^~ 0x238b15e internal_error(char const*, ...) ???:0 0xa11270 fancy_abort(char const*, int, char const*) ???:0 0x13ee023 vectorizable_induction(_loop_vec_info*, _stmt_vec_info*, gimple**, _slp_tree*, vec<stmt_info_for_cost, va_heap, vl_ptr>*) ???:0 0x2115bf8 vect_transform_stmt(vec_info*, _stmt_vec_info*, gimple_stmt_iterator*, _slp_tree*, _slp_instance*) ???:0 0x13fedc0 vect_transform_loop(_loop_vec_info*, gimple*) ???:0 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. Compiler returned: 1 ```
Simplier testcase: ``` short int w9; struct T { short a : 14; int b; }; struct T v; void zc() { for(int i = 0; i < 4; i ++) w9 *= v.b ? v.a-- < 0 : 0; } ``` Just compiler at `-O3 -fno-vect-cost-model` <unnamed-unsigned:14> _30; vector(4) unsigned short _31; ... _31 = {_60, _59, _2, _30}; _52 = (vector(4) signed short) _31;
Looks like 11.x was not able to vectorize the loop.
Again bit-precision int:14 vs. 'int'. Fallout of the bitfield vectorization support I guess. Like the other PR we can fend this off in vectorizable_induction (I suppose vectorizable_reduction might have similar issues).
Started with r10-4076-g82e8e335f917b9ce40801838c06f7945cf88da43
I have a patch.
The master branch has been updated by Richard Biener <rguenth@gcc.gnu.org>: https://gcc.gnu.org/g:ec345df53556ec581590347f71c3d9ff3cdbca76 commit r14-7140-gec345df53556ec581590347f71c3d9ff3cdbca76 Author: Richard Biener <rguenther@suse.de> Date: Thu Jan 11 14:00:33 2024 +0100 tree-optimization/112505 - bit-precision induction vectorization Vectorization of bit-precision inductions isn't implemented but we don't check this, instead we ICE during transform. PR tree-optimization/112505 * tree-vect-loop.cc (vectorizable_induction): Reject bit-precision induction. * gcc.dg/vect/pr112505.c: New testcase.
The releases/gcc-13 branch has been updated by Richard Biener <rguenth@gcc.gnu.org>: https://gcc.gnu.org/g:9895fc7ab14f4cf571071184877f130b7bd0a59b commit r13-8290-g9895fc7ab14f4cf571071184877f130b7bd0a59b Author: Richard Biener <rguenther@suse.de> Date: Thu Jan 11 14:00:33 2024 +0100 tree-optimization/112505 - bit-precision induction vectorization Vectorization of bit-precision inductions isn't implemented but we don't check this, instead we ICE during transform. PR tree-optimization/112505 * tree-vect-loop.cc (vectorizable_induction): Reject bit-precision induction. * gcc.dg/vect/pr112505.c: New testcase. (cherry picked from commit ec345df53556ec581590347f71c3d9ff3cdbca76)
The releases/gcc-12 branch has been updated by Richard Biener <rguenth@gcc.gnu.org>: https://gcc.gnu.org/g:4a71557fbebe3fb4031d1c2adc4f89c89a8c6c62 commit r12-10454-g4a71557fbebe3fb4031d1c2adc4f89c89a8c6c62 Author: Richard Biener <rguenther@suse.de> Date: Thu Jan 11 14:00:33 2024 +0100 tree-optimization/112505 - bit-precision induction vectorization Vectorization of bit-precision inductions isn't implemented but we don't check this, instead we ICE during transform. PR tree-optimization/112505 * tree-vect-loop.cc (vectorizable_induction): Reject bit-precision induction. * gcc.dg/vect/pr112505.c: New testcase. (cherry picked from commit ec345df53556ec581590347f71c3d9ff3cdbca76)
The releases/gcc-11 branch has been updated by Richard Biener <rguenth@gcc.gnu.org>: https://gcc.gnu.org/g:ffaa61eb15dce3e48b4dcbca7161fc79ac9734b8 commit r11-11524-gffaa61eb15dce3e48b4dcbca7161fc79ac9734b8 Author: Richard Biener <rguenther@suse.de> Date: Thu Jan 11 14:00:33 2024 +0100 tree-optimization/112505 - bit-precision induction vectorization Vectorization of bit-precision inductions isn't implemented but we don't check this, instead we ICE during transform. PR tree-optimization/112505 * tree-vect-loop.c (vectorizable_induction): Reject bit-precision induction. * gcc.dg/vect/pr112505.c: New testcase. (cherry picked from commit ec345df53556ec581590347f71c3d9ff3cdbca76)
Fixed.