]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Update x86: Call ix86_access_stack_p only for larger alignment
authorH.J. Lu <hjl.tools@gmail.com>
Tue, 7 Apr 2026 10:12:27 +0000 (18:12 +0800)
committerH.J. Lu <hjl.tools@gmail.com>
Tue, 7 Apr 2026 21:22:57 +0000 (05:22 +0800)
commit f511bf93f947199a9f9099fee87b7052e5515fb9
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Sun Mar 29 14:30:28 2026 -0700

    x86: Call ix86_access_stack_p only for larger alignment

incorrectly uses GET_MODE_ALIGNMENT as memory alignment since memory
alignment can be different from mode alignment as in

(set (reg:OI 20 xmm0 [orig:112 s ] [112])
     (mem/c:OI (plus:DI (reg/f:DI 7 sp)
            (const_int -32 [0xffffffffffffffe0])) [3 s+0 S32 A128]))

MEM_ALIGN should be used instead.

* config/i386/i386.cc (ix86_need_alignment_p_1): Replace
GET_MODE_ALIGNMENT with MEM_ALIGN.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
gcc/config/i386/i386.cc

index 39136ce5042dedf6e72a4517d4ec47ed9bbb7e53..f4d0f6239433ba1a2f7d00a348908b928726610d 100644 (file)
@@ -8789,7 +8789,7 @@ ix86_need_alignment_p_1 (rtx set, unsigned int alignment)
   rtx dest = SET_DEST (set);
 
   if (MEM_P (dest))
-    return GET_MODE_ALIGNMENT (GET_MODE (dest)) > alignment;
+    return MEM_ALIGN (dest) > alignment;
 
   const_rtx src = SET_SRC (set);
 
@@ -8799,7 +8799,7 @@ ix86_need_alignment_p_1 (rtx set, unsigned int alignment)
       auto op = *iter;
 
       if (MEM_P (op))
-       return GET_MODE_ALIGNMENT (GET_MODE (op)) > alignment;
+       return MEM_ALIGN (op) > alignment;
     }
 
   return false;