https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91528
--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> --- (In reply to Uroš Bizjak from comment #3) > (In reply to Richard Biener from comment #1) > > (gdb) p x_rtl.drap_reg > > $1 = (rtx) 0x0 > > > > so > > > > 7843 /* Only need to push parameter pointer reg if it is caller > > saved. */ > > 7844 if (!call_used_regs[REGNO (crtl->drap_reg)]) > > 7845 { > > > > segfaults. This must be really a latent issue. I guess > > > > /* Conversion means we may have 128bit register spills/fills > > which require aligned stack. */ > > if (converted_insns) > > { > > if (crtl->stack_alignment_needed < 128) > > ... > > > > needs to do some magic for -mforce-drap (which might be handled too early, > > ignoring the late generated xmm uses?) > > When changing stack_alignment_{needed,estimated}, we also need to update > dependent crtl variables, similar to what expand_stack_alignment from > cfgexpand.c does. Following (untested) patch fixes the testcase failure: > > --cut here-- > diff --git a/gcc/config/i386/i386-features.c > b/gcc/config/i386/i386-features.c > index fb7ac1b7d102..594b572454df 100644 > --- a/gcc/config/i386/i386-features.c > +++ b/gcc/config/i386/i386-features.c > @@ -1770,6 +1770,28 @@ convert_scalars_to_vector (bool timode_p) > crtl->stack_alignment_needed = 128; > if (crtl->stack_alignment_estimated < 128) > crtl->stack_alignment_estimated = 128; > + > + crtl->stack_realign_needed > + = INCOMING_STACK_BOUNDARY < crtl->stack_alignment_estimated; > + crtl->stack_realign_tried = crtl->stack_realign_needed; > + > + crtl->stack_realign_processed = true; > + > + rtx drap_rtx = targetm.calls.get_drap_rtx (); > + > + /* stack_realign_drap and drap_rtx must match. */ > + gcc_assert ((stack_realign_drap != 0) == (drap_rtx != NULL)); > + > + /* Do nothing if NULL is returned, which means DRAP is not needed. */ > + if (drap_rtx != NULL) > + { > + crtl->args.internal_arg_pointer = drap_rtx; > + > + /* Call fixup_tail_calls to clean up REG_EQUIV note if DRAP is > + needed. */ > + fixup_tail_calls (); > + } > + > /* Fix up DECL_RTL/DECL_INCOMING_RTL of arguments. */ > if (TARGET_64BIT) > for (tree parm = DECL_ARGUMENTS (current_function_decl); > --cut here-- > > HJ, can you please take the patch from here? Realignment stuff is a bit of > mistery to me. Also fixes all libada issues I ran into when bootstrapping with --with-arch=westmere and cutting off the cost-model to always consider chains profitable to convert.