https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123573
--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Richard Biener <[email protected]>: https://gcc.gnu.org/g:e787d5ace5cc315892868f3e5e2a2a16fd31bcc8 commit r16-6743-ge787d5ace5cc315892868f3e5e2a2a16fd31bcc8 Author: Richard Biener <[email protected]> Date: Tue Jan 13 12:59:41 2026 +0100 middle-end/123573 - fix VEC_PERM folding more The following fixes the fix from r16-6709-ga4716ece529dfd some more by making sure permute to one operand folding faces same element number vectors but also insert a VIEW_CONVERT_EXPR for the case one is VLA and one is VLS (when the VLA case is actually constant, like with -msve-vector-bits=128). It also makes the assert that output and input element numbers match done in fold_vec_perm which this pattern eventually dispatches to into a check (as the comment already indicates). Testcases are in the target specific aarch64 testsuite already. PR middle-end/123573 * fold-const.cc (fold_vec_perm): Actually check, not assert, that input and output vector element numbers agree. * match.pd (vec_perm @0 @1 @2): Make sure element numbers are the same when folding to an input vector and wrap that inside a VIEW_CONVERT_EXPR.
