On Mon, Oct 19, 2009 at 6:25 PM, Michael Matz wrote: > Hi, > > On Mon, 19 Oct 2009, H.J. Lu wrote: > >> > He tries to solve this by pessimistically assuming that potentially >> > everything imaginable could go on stack.  What I don't understand is >> > why we don't instead track hard_stack_alignment in assign_*_temp >> > (where we then assume that the stack will be aligned perfectly), and >> > expand stack realignment code _after_ having expanded everything else >> > (plus examined local variables for the possibility of generating spill >> > slots). >> >> Vectorizer may not call assign_*_temp at all. Instead, x86 backend may >> call gen_reg_rtx to generate pseudo registers when expanding vector >> statement. > > If that (and not assign_*_temp) is the problem, then it's obvious that > fiddling with the vectorizer doesn't solve it.  The expanders can create > new pseudos for whatever they see fit.  For expanding vector statements, > for expanding block moves, for expanding string compares, for expanding > additions, for anything.  Mucking around with the vectorizer won't solve > the problem. > Here is a new patch. I added hard_stack_alignment, moved update_stack_boundary after RTL expansion and updated ix86_function_ok_for_sibcall to deal with it. Any comments? Thanks. -- H.J. --- gcc/ 2009-10-20 H.J. Lu PR target/40836 * cfgexpand.c (get_decl_align_unit): Update hard_stack_alignment. (expand_one_var): Likewise. (gimple_expand_cfg): Initialize hard_stack_alignment to 0. Move update_stack_boundary call to ... (expand_stack_alignment): Here. * emit-rtl.c (gen_reg_rtx): Update hard_stack_alignment. * function.c (assign_stack_local_1): Likewise. (assign_parms): Likewise. (locate_and_pad_parm): Likewise. * function.h (rtl_data): Add hard_stack_alignment. * config/i386/i386.c (ix86_minimum_incoming_stack_boundary): New. (verride_options): Don't check ix86_force_align_arg_pointer here. (ix86_function_ok_for_sibcall): Use it. (ix86_update_stack_boundary): Likewise. * config/i386/i386.h (STACK_REALIGN_DEFAULT): Update comments. gcc/testsuite/ 2009-10-20 H.J. Lu PR target/40838 * gcc.target/i386/incoming-6.c: New. * gcc.target/i386/incoming-7.c: Likewise. * gcc.target/i386/incoming-8.c: Likewise. * gcc.target/i386/incoming-9.c: Likewise. * gcc.target/i386/incoming-10.c: Likewise. * gcc.target/i386/incoming-11.c: Likewise. * gcc.target/i386/incoming-12.c: Likewise. * gcc.target/i386/incoming-13.c: Likewise. * gcc.target/i386/incoming-14.c: Likewise. * gcc.target/i386/incoming-15.c: Likewise.