https://gcc.gnu.org/g:1547c0a5a46a9730547c36b6e8fccc0a25123f1a
commit r16-272-g1547c0a5a46a9730547c36b6e8fccc0a25123f1a Author: Uros Bizjak <ubiz...@gmail.com> Date: Tue Apr 29 08:28:37 2025 +0200 i386: Skip sub-RTXes of memory operand in ix86_update_stack_alignment Skip sub-RTXes of the memory operand if stack access register is not mentioned in the operand. gcc/ChangeLog: * config/i386/i386.cc (ix86_update_stack_alignment): Skip sub-RTXes of the memory operand if stack access register is not mentioned in the operand. Diff: --- gcc/config/i386/i386.cc | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc index ae2386785afa..bfd9cac215ad 100644 --- a/gcc/config/i386/i386.cc +++ b/gcc/config/i386/i386.cc @@ -8495,13 +8495,18 @@ ix86_update_stack_alignment (rtx, const_rtx pat, void *data) FOR_EACH_SUBRTX (iter, array, pat, ALL) { auto op = *iter; - if (MEM_P (op) && reg_mentioned_p (p->reg, op)) + if (MEM_P (op)) { - unsigned int alignment = MEM_ALIGN (op); + if (reg_mentioned_p (p->reg, XEXP (op, 0))) + { + unsigned int alignment = MEM_ALIGN (op); - if (alignment > *p->stack_alignment) - *p->stack_alignment = alignment; - break; + if (alignment > *p->stack_alignment) + *p->stack_alignment = alignment; + break; + } + else + iter.skip_subrtxes (); } } }