diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 327564f5883..6340afe464f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2015-07-15 Uros Bizjak + + PR rtl-optimization/58066 + * calls.c (expand_call): Precompute register parameters before stack + alignment is performed. + 2015-07-15 Uros Bizjak PR rtl-optimization/66838 diff --git a/gcc/calls.c b/gcc/calls.c index 143e6125bd8..2a297b0dc95 100644 --- a/gcc/calls.c +++ b/gcc/calls.c @@ -3144,6 +3144,13 @@ expand_call (tree exp, rtx target, int ignore) compute_argument_addresses (args, argblock, num_actuals); + /* Precompute all register parameters. It isn't safe to compute + anything once we have started filling any specific hard regs. + TLS symbols sometimes need a call to resolve. Precompute + register parameters before any stack pointer manipulation + to avoid unaligned stack in the called function. */ + precompute_register_parameters (num_actuals, args, ®_parm_seen); + /* Perform stack alignment before the first push (the last arg). */ if (argblock == 0 && adjusted_args_size.constant > reg_parm_stack_space @@ -3184,10 +3191,6 @@ expand_call (tree exp, rtx target, int ignore) funexp = rtx_for_function_call (fndecl, addr); - /* Precompute all register parameters. It isn't safe to compute anything - once we have started filling any specific hard regs. */ - precompute_register_parameters (num_actuals, args, ®_parm_seen); - if (CALL_EXPR_STATIC_CHAIN (exp)) static_chain_value = expand_normal (CALL_EXPR_STATIC_CHAIN (exp)); else