https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111225
--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Vladimir Makarov <vmaka...@gcc.gnu.org>: https://gcc.gnu.org/g:f7bca44d97ad01b39f9d6e7809df7bf517eeb2fb commit r14-3783-gf7bca44d97ad01b39f9d6e7809df7bf517eeb2fb Author: Vladimir N. Makarov <vmaka...@redhat.com> Date: Thu Sep 7 09:59:10 2023 -0400 [LRA]: Don't reuse chosen insn alternative with special memory constraint To speed up GCC, LRA reuses chosen alternative from previous constraint subpass. A spilled pseudo is considered ok for any memory constraint although stack slot assigned to the pseudo later might not satisfy the chosen alternative constraint. As we don't consider all insn alternatives on the subsequent LRA sub-passes, it might result in LRA failure to generate the correct insn. This patch solves the problem. gcc/ChangeLog: PR target/111225 * lra-constraints.cc (goal_reuse_alt_p): New global flag. (process_alt_operands): Set up the flag. Clear flag for chosen alternative with special memory constraints. (process_alt_operands): Set up used insn alternative depending on the flag. gcc/testsuite/ChangeLog: PR target/111225 * gcc.target/i386/pr111225.c: New test.