https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98037
--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-10 branch has been updated by Richard Sandiford <rsand...@gcc.gnu.org>: https://gcc.gnu.org/g:fb9ee3e7419178e6530c09b99272022d062b50f3 commit r10-9108-gfb9ee3e7419178e6530c09b99272022d062b50f3 Author: Richard Sandiford <richard.sandif...@arm.com> Date: Wed Dec 2 16:20:34 2020 +0000 dse: Cope with bigger-than-integer modes [PR98037] dse.c:find_shift_sequence tries to represent a store and load back as a shift right followed by a truncation. It therefore needs to find an integer mode in which to do the shift right. The loop it uses has the form: FOR_EACH_MODE_FROM (new_mode_iter, smallest_int_mode_for_size (GET_MODE_BITSIZE (read_mode))) which implicitly assumes that read_mode has an equivalent integer mode. As shown in the testcase, not all modes have such an integer mode. This patch just makes the code start from the smallest integer mode and skip modes that are too small. The loop already breaks at the first mode wider than word_mode. gcc/ PR rtl-optimization/98037 * dse.c (find_shift_sequence): Iterate over all integers and skip modes that are too small. gcc/testsuite/ PR rtl-optimization/98037 * gcc.target/aarch64/sve/acle/general/pr98037.c: New test. (cherry picked from commit f835e9f6562dda9c8a1384be2c9d4e45c112ed8e)