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

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |crazylht at gmail dot com

--- Comment #10 from H.J. Lu <hjl.tools at gmail dot com> ---
We have

static bool
ix86_can_eliminate (const int from, const int to)
{
  if (stack_realign_fp)
    return ((from == ARG_POINTER_REGNUM
             && to == HARD_FRAME_POINTER_REGNUM)
            || (from == FRAME_POINTER_REGNUM
                && to == STACK_POINTER_REGNUM));
  else  
    return to == STACK_POINTER_REGNUM ? !frame_pointer_needed : true; 
}

Before IRA, stack_realign_fp is set to true by AVX piecewise move and store.
LRA replaces frame pointer with stack pointer:

insn 259 261 297 4 (set (reg/f:DI 2 cx [144])
        (plus:DI (reg/f:DI 7 sp)
            (const_int -32 [0xffffffffffffffe0]))) 241 {*leadi}
     (expr_list:REG_EQUAL (plus:DI (reg/f:DI 19 frame)
            (const_int -32 [0xffffffffffffffe0]))
        (nil)))

In ix86_finalize_stack_frame_flags, stack_realign_fp is set to false. Since
the stack realignment skipped, local variable is no longer properly aligned.

Reply via email to