https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82221
--- Comment #11 from H.J. Lu <hjl.tools at gmail dot com> --- (In reply to Josh Poimboeuf from comment #9) > I might be misunderstanding, but I don't think we need DRAP for our use > case. We just need assurance that the frame pointer (RBP) has been set up > before the inline asm is inserted. > The problem is #define stack_realign_fp (crtl->stack_realign_needed && !crtl->need_drap) Since function returns 64-bit integer and incoming stack is aligned to 32 bits, initially GCC assume stack realignment is needed. If need_drap is false, stack_realign_fp is true. In this case, we won't eliminate frame pointer with stack pointer 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; } when sp_is_unchanging is false. Setting need_drap when sp_is_unchanging is false allows it to work. BTW, drap is really used since stack_realign_needed is changed to false by ix86_finalize_stack_frame_flags.