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

--- Comment #7 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by H.J. Lu <[email protected]>:

https://gcc.gnu.org/g:7b39d7b3b84d4d098b51bbdbd15e6ddea6bf99db

commit r16-8516-g7b39d7b3b84d4d098b51bbdbd15e6ddea6bf99db
Author: H.J. Lu <[email protected]>
Date:   Fri Apr 3 15:55:17 2026 +0800

    Correct x86: Call ix86_access_stack_p only for larger alignment

    commit f511bf93f947199a9f9099fee87b7052e5515fb9
    Author: H.J. Lu <[email protected]>
    Date:   Sun Mar 29 14:30:28 2026 -0700

        x86: Call ix86_access_stack_p only for larger alignment

    has 2 issues:

    1. It didn't exclude memory with SYMBOLIC_CONST when checking for stack
    access.
    2. It replaced:

      HARD_REG_SET hard_stack_slot_access = stack_slot_access;
      ...
          bool symbolic_const_load_p = false;

          if (!TEST_HARD_REG_BIT (hard_stack_slot_access, regno))
            ...
            symbolic_const_load_p = true;
          ...

          if (!symbolic_const_load_p
              || ix86_access_stack_p...)
            call ix86_update_stack_alignment.

    with

          if (ix86_need_alignment_p...
              && ix86_access_stack_p...)
            call ix86_update_stack_alignment.

    Since ix86_access_stack_p excludes registers on hard_stack_slot_access,
    stack alignment isn't updated for registers on hard_stack_slot_access.
    Instead, we should do

          if (ix86_need_alignment_p...
              && (TEST_HARD_REG_BIT (hard_stack_slot_access, regno)
                  || ix86_access_stack_p...))
            call ix86_update_stack_alignment.

    The compile times of PR target/124165 and PR target/124684 test are
    unchanged.

          if (ix86_need_alignment_p...
              && (TEST_HARD_REG_BIT (hard_stack_slot_access, regno)
                  || ix86_access_stack_p...))
            call ix86_update_stack_alignment.

    gcc/

            PR target/124759
            PR target/124789
            * config/i386/i386.cc (ix86_need_alignment_p_2): New function.
            Exclude memory with SYMBOLIC_CONST.
            (ix86_need_alignment_p_1): Call ix86_need_alignment_p_2.
            (ix86_find_max_used_stack_alignment): Restore
            hard_stack_slot_access handling.

    gcc/testsuite/

            PR target/124759
            PR target/124789
            * gcc.target/i386/pr124759.c: New test.

    Signed-off-by: H.J. Lu <[email protected]>

Reply via email to