https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121772
--- Comment #10 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-15 branch has been updated by Alex Coplan <acop...@gcc.gnu.org>: https://gcc.gnu.org/g:8bc078455cdc2c53a469bbcadb9a7c3bc7a1929e commit r15-10373-g8bc078455cdc2c53a469bbcadb9a7c3bc7a1929e Author: Alex Coplan <alex.cop...@arm.com> Date: Tue Sep 9 12:57:14 2025 +0100 match.pd: Add missing type check to reduc(ctor) pattern [PR121772] In this PR we have a reduction of a vector constructor, where the type of the constructor is int16x8_t and the elements are int16x4_t; i.e. it is representing a concatenation of two vectors. This triggers a match.pd pattern which looks like it was written to handle reductions of vector constructors where the elements of the ctor are scalars, not vectors. There is no type check to enforce this property, which leads to the pattern replacing a reduction to scalar with an int16x4_t vector in this case, which of course is a type error, leading to an invalid GIMPLE ICE. This patch adds a type check to the pattern, only going ahead with the transformation if the element type of the ctor matches that of the reduction. gcc/ChangeLog: PR tree-optimization/121772 * match.pd: Add type check to reduc(ctor) pattern. gcc/testsuite/ChangeLog: PR tree-optimization/121772 * gcc.target/aarch64/torture/pr121772.c: New test. (cherry picked from commit a7a9b7badc0ba95b510c7e61da6439fca78e31d3)