https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106122

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Roger Sayle <sa...@gcc.gnu.org>:

https://gcc.gnu.org/g:17419b61edd350147b0cc10c3da0b8461e51a42c

commit r13-1380-g17419b61edd350147b0cc10c3da0b8461e51a42c
Author: Roger Sayle <ro...@nextmovesoftware.com>
Date:   Fri Jul 1 09:18:07 2022 +0100

    PR target/106122: Don't update %esp via the stack with -Oz on x86.

    When optimizing for size with -Oz, setting a register can be minimized by
    pushing an immediate value to the stack and popping it to the destination.
    Alas the one general register that shouldn't be updated via the stack is
    the stack pointer itself, where "pop %esp" can't be represented in GCC's
    RTL ("use of a register mentioned in pre_inc, pre_dec, post_inc or
    post_dec is not permitted within the same instruction").  This patch
    fixes PR target/106122 by explicitly checking for SP_REG in the
    problematic peephole2.

    2022-07-01  Roger Sayle  <ro...@nextmovesoftware.com>

    gcc/ChangeLog
            PR target/106122
            * config/i386/i386.md (peephole2): Avoid generating pop %esp
            when optimizing for size.

    gcc/testsuite/ChangeLog
            PR target/106122
            * gcc.target/i386/pr106122.c: New test case.

Reply via email to