https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124407
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
redundant_pattern doesn't seem to track the mode of val (needed when it has
VOIDmode).
Or can it be assumed to be an integral mode of the same size as load->mode or
reg?
Plus
if ((REG_P (inner_scalar) || MEM_P (inner_scalar))
&& GET_MODE (reg) != GET_MODE (inner_scalar))
inner_scalar = gen_rtx_SUBREG (GET_MODE (reg), inner_scalar, 0);
only deals with mode differences for REG/MEM, not for constants, guess for
constants those need to be simplified SUBREG and tested whether set with such a
constant is actually supported.