re PR target/39146 (Unnecessary stack alignment)

gcc/

2009-06-12  Joey Ye  <joey.ye@intel.com>

	PR middle-end/39146
	* cfgexpand.c (get_decl_align_unit): Update
	max_used_stack_slot_alignment with align instead of
	stack_alignment_needed.

	* function.c (assign_stack_local_1): Update
	max_used_stack_slot_alignment with alignment_in_bits instead
	of stack_alignment_needed.
	(locate_and_pad_parm): Don't update max_used_stack_slot_alignment
	here.

gcc/testsuite/

2009-06-12  Joey Ye  <joey.ye@intel.com>
	    H.J. Lu  <hongjiu.lu@intel.com>

	PR middle-end/39146
	* gcc.target/i386/stackalign/pr39146.c: New.

From-SVN: r148428
This commit is contained in:
Joey Ye 2009-06-12 05:54:30 -07:00 committed by H.J. Lu
parent fc9f468b5f
commit f85882d8e1
5 changed files with 37 additions and 7 deletions

View File

@ -1,3 +1,16 @@
2009-06-12 Joey Ye <joey.ye@intel.com>
PR middle-end/39146
* cfgexpand.c (get_decl_align_unit): Update
max_used_stack_slot_alignment with align instead of
stack_alignment_needed.
* function.c (assign_stack_local_1): Update
max_used_stack_slot_alignment with alignment_in_bits instead
of stack_alignment_needed.
(locate_and_pad_parm): Don't update max_used_stack_slot_alignment
here.
2009-06-12 Jakub Jelinek <jakub@redhat.com>
* dwarf2out.c (last_var_location_insn): New variable.
@ -8,7 +21,7 @@
2009-06-11 Richard Henderson <rth@redhat.com>
* alpha.c (alpha_expand_prologue): Add a REF_CFA_REGISTER
* alpha.c (alpha_expand_prologue): Add a REF_CFA_REGISTER
note when storing the frame pointer in a register.
(FRP): Don't redefine to nothing for epilogue.
(alpha_expand_epilogue): Mark register and sp restores.

View File

@ -564,8 +564,8 @@ get_decl_align_unit (tree decl)
So here we only make sure stack_alignment_needed >= align. */
if (crtl->stack_alignment_needed < align)
crtl->stack_alignment_needed = align;
if (crtl->max_used_stack_slot_alignment < crtl->stack_alignment_needed)
crtl->max_used_stack_slot_alignment = crtl->stack_alignment_needed;
if (crtl->max_used_stack_slot_alignment < align)
crtl->max_used_stack_slot_alignment = align;
return align / BITS_PER_UNIT;
}

View File

@ -355,8 +355,8 @@ assign_stack_local_1 (enum machine_mode mode, HOST_WIDE_INT size,
if (crtl->stack_alignment_needed < alignment_in_bits)
crtl->stack_alignment_needed = alignment_in_bits;
if (crtl->max_used_stack_slot_alignment < crtl->stack_alignment_needed)
crtl->max_used_stack_slot_alignment = crtl->stack_alignment_needed;
if (crtl->max_used_stack_slot_alignment < alignment_in_bits)
crtl->max_used_stack_slot_alignment = alignment_in_bits;
/* Calculate how many bytes the start of local variables is off from
stack alignment. */
@ -3520,8 +3520,6 @@ locate_and_pad_parm (enum machine_mode passed_mode, tree type, int in_regs,
calling function side. */
if (crtl->stack_alignment_needed < boundary)
crtl->stack_alignment_needed = boundary;
if (crtl->max_used_stack_slot_alignment < crtl->stack_alignment_needed)
crtl->max_used_stack_slot_alignment = crtl->stack_alignment_needed;
if (crtl->preferred_stack_boundary < boundary)
crtl->preferred_stack_boundary = boundary;

View File

@ -1,3 +1,9 @@
2009-06-12 Joey Ye <joey.ye@intel.com>
H.J. Lu <hongjiu.lu@intel.com>
PR middle-end/39146
* gcc.target/i386/stackalign/pr39146.c: New.
2009-06-11 H.J. Lu <hongjiu.lu@intel.com>
* gcc.target/i386/crc32-1.c: New.

View File

@ -0,0 +1,13 @@
/* { dg-do compile { target i?86-*-* x86_64-*-* } } */
/* { dg-options "-O2 -mavx" } */
typedef long long __m256i __attribute__ ((__vector_size__ (32), __may_alias__));
__m256i
bar (__m256i x)
{
return x;
}
/* { dg-final { scan-assembler-not "and\[lq\]?\[^\\n\]*-32,\[^\\n\]*sp" } } */