]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
i386: Skip sub-RTXes of memory operand in ix86_update_stack_alignment
authorUros Bizjak <ubizjak@gmail.com>
Tue, 29 Apr 2025 06:28:37 +0000 (08:28 +0200)
committerUros Bizjak <ubizjak@gmail.com>
Tue, 29 Apr 2025 07:10:19 +0000 (09:10 +0200)
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.

gcc/config/i386/i386.cc

index ae2386785afa31de8edf764e0e39702ae73e5133..bfd9cac215ad4369f9dfb20290c6d6165ec506fb 100644 (file)
@@ -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 ();
        }
     }
 }