https://gcc.gnu.org/bugzilla/show_bug.cgi?id=128995
--- Comment #6 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-14 branch has been updated by Richard Earnshaw <[email protected]>: https://gcc.gnu.org/g:465e3ffa3d12c2c933310195b16677bcc3234a87 commit r14-13065-g465e3ffa3d12c2c933310195b16677bcc3234a87 Author: Richard Earnshaw <[email protected]> Date: Tue Dec 1 18:19:04 2026 +0000 arm: fix peep2 for strd or stm of literals [PR128995] The sequence MOV regA, const1 MOV regA, const2 STR regA, [mem] STR regA, [mem+4] Cannot be converted into a 64-bit store of const1 and const2 because the first mov is really dead code (regA gets overwritten before use). We wouldn't normally expect to see something like this since the instruction is redunant. However, the peep2 patterns were never taught to expect this anomolous sequence. There are two classes of patterns that need fixing. The first class is for using strd, when available. The second uses stm and applies to all variants. Improve the checks on the peepholes to ensure the two MOV instructions write to distinct registers. I haven't added a testcode because it would be too fragile, relying on the compiler not cleaning up a dead store. gcc/ChangeLog: PR target/128995 * config/arm/arm.cc (gen_const_stm_seq): New argument unique_regs. If true, don't permit two regs to overlap. * config/arm/arm-protos.h (gen_const_stm_seq): Update prototype. * config/arm/ldmstm.md (peep2 patterns for stm of constants): Update callers. * config/arm/ldrdstrd.md (peep2 for strd of constants): Ensure the two MOV instructions write distinct registers. (cherry picked from commit dee6d6cf2c2ae271ccb26b7c27d926d62c04b42e)
