+2017-09-17 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR target/82166
+ * config/i386/i386.c (ix86_finalize_stack_frame_flags): Properly
+ compute the minimum stack alignment. Also update preferred stack
+ boundary for leaf functions.
+
2017-09-16 Richard Sandiford <richard.sandiford@linaro.org>
PR tree-optimization/82228
unsigned int incoming_stack_boundary
= (crtl->parm_stack_boundary > ix86_incoming_stack_boundary
? crtl->parm_stack_boundary : ix86_incoming_stack_boundary);
+ unsigned int stack_alignment
+ = (crtl->is_leaf && !ix86_current_function_calls_tls_descriptor
+ ? crtl->max_used_stack_slot_alignment
+ : crtl->stack_alignment_needed);
unsigned int stack_realign
- = (incoming_stack_boundary
- < (crtl->is_leaf && !ix86_current_function_calls_tls_descriptor
- ? crtl->max_used_stack_slot_alignment
- : crtl->stack_alignment_needed));
+ = (incoming_stack_boundary < stack_alignment);
bool recompute_frame_layout_p = false;
if (crtl->stack_realign_finalized)
HARD_FRAME_POINTER_REGNUM);
/* The preferred stack alignment is the minimum stack alignment. */
- unsigned int stack_alignment = crtl->preferred_stack_boundary;
+ if (stack_alignment > crtl->preferred_stack_boundary)
+ stack_alignment = crtl->preferred_stack_boundary;
+
bool require_stack_frame = false;
FOR_EACH_BB_FN (bb, cfun)
= incoming_stack_boundary;
crtl->stack_alignment_needed
= incoming_stack_boundary;
+ /* Also update preferred_stack_boundary for leaf
+ functions. */
+ crtl->preferred_stack_boundary
+ = incoming_stack_boundary;
}
}
else