From: Richard Biener <richard.guenther@gmail.com>
To: Alexandre Oliva <aoliva@redhat.com>
Cc: Alan Lawrence <alan.lawrence@arm.com>, Jeff Law <law@redhat.com>,
James Greenhalgh <James.Greenhalgh@arm.com>,
"H.J. Lu" <hjl.tools@gmail.com>,
Segher Boessenkool <segher@kernel.crashing.org>,
GCC Patches <gcc-patches@gcc.gnu.org>,
Christophe Lyon <christophe.lyon@linaro.org>,
David Edelsohn <dje.gcc@gmail.com>,
Eric Botcazou <ebotcazou@adacore.com>
Subject: Re: [PR64164] drop copyrename, integrate into expand
Date: Thu, 05 Nov 2015 13:44:00 -0000 [thread overview]
Message-ID: <CAFiYyc1HA-pKA4EHHar08dUUdQ1a16gCD3m4d2rKFBPS2ALc5w@mail.gmail.com> (raw)
In-Reply-To: <or7flxhw2r.fsf@livre.home>
On Thu, Nov 5, 2015 at 6:08 AM, Alexandre Oliva <aoliva@redhat.com> wrote:
> On Sep 23, 2015, Alexandre Oliva <aoliva@redhat.com> wrote:
>
>> @@ -2982,38 +2887,39 @@ assign_parm_setup_block (struct assign_parm_data_all *all,
> [snip]
>> + if (GET_CODE (reg) != CONCAT)
>> + stack_parm = reg;
>> + else
>> + /* This will use or allocate a stack slot that we'd rather
>> + avoid. FIXME: Could we avoid it in more cases? */
>> + target_reg = reg;
>
> It turns out that we can, and that helps fixing PR67753. In the end, I
> ended up using the ABI-reserved stack slot if there is one, but just
> allocating an unsplit complex pseudo fixes all remaining cases that used
> to require the allocation of a stack slot. Yay!
>
> As for pr67753 proper, we emitted the store of the PARALLEL entry_parm
> into the stack parm only in the conversion seq, which was ultimately
> emitted after the copy from stack_parm to target_reg that was supposed
> to copy the value originally in entry_parm. So we copied an
> uninitialized stack slot, and the subsequent store in the conversion seq
> was optimized out as dead.
>
> This caused a number of regressions on hppa-linux-gnu. The fix for this
> is to arrange for the copy to target_reg to be emitted in the conversion
> seq if the copy to stack_parm was. I can't determine whether this fix
> all reported regressions, but from visual inspection of the generated
> code I'm pretty sure it fixes at least gcc.c-torture/execute/pr38969.c.
>
>
> When we do NOT have an ABI-reserved stack slot, the store of the
> PARALLEL entry_parm into the intermediate pseudo doesn't need to go in
> the conversion seq (emit_group_store from a PARALLEL to a pseudo only
> uses registers, according to another comment in function.c), so I've
> simplified that case.
>
>
> This was regstrapped on x86_64-linux-gnu, i686-linux-gnu,
> ppc64-linux-gnu, ppc64el-linux-gnu, and cross-build-tested for all
> targets for which I've tested the earlier patches in the patchset.
> Ok to install?
Ok.
Thanks,
Richard.
>
>
> [PR67753] fix copy of PARALLEL entry_parm to CONCAT target_reg
>
> From: Alexandre Oliva <aoliva@redhat.com>
>
> In assign_parms_setup_block, the copy of args in PARALLELs from
> entry_parm to stack_parm is deferred to the parm conversion insn seq,
> but the copy from stack_parm to target_reg was inserted in the normal
> copy seq, that is executed before the conversion insn seq. Oops.
>
> We could do away with the need for an actual stack_parm in general,
> which would have avoided the need for emitting the copy to target_reg
> in the conversion seq, but at least on pa, due to the need for stack
> to copy between SI and SF modes, it seems like using the reserved
> stack slot is beneficial, so I put in logic to use a pre-reserved
> stack slot when there is one, and emit the copy to target_reg in the
> conversion seq if stack_parm was set up there.
>
> for gcc/ChangeLog
>
> PR rtl-optimization/67753
> PR rtl-optimization/64164
> * function.c (assign_parm_setup_block): Avoid allocating a
> stack slot if we don't have an ABI-reserved one. Emit the
> copy to target_reg in the conversion seq if the copy from
> entry_parm is in it too. Don't use the conversion seq to copy
> a PARALLEL to a REG or a CONCAT.
> ---
> gcc/function.c | 39 ++++++++++++++++++++++++++++++++++-----
> 1 file changed, 34 insertions(+), 5 deletions(-)
>
> diff --git a/gcc/function.c b/gcc/function.c
> index aaf49a4..156c72b 100644
> --- a/gcc/function.c
> +++ b/gcc/function.c
> @@ -2879,6 +2879,7 @@ assign_parm_setup_block (struct assign_parm_data_all *all,
> rtx entry_parm = data->entry_parm;
> rtx stack_parm = data->stack_parm;
> rtx target_reg = NULL_RTX;
> + bool in_conversion_seq = false;
> HOST_WIDE_INT size;
> HOST_WIDE_INT size_stored;
>
> @@ -2895,9 +2896,23 @@ assign_parm_setup_block (struct assign_parm_data_all *all,
> if (GET_CODE (reg) != CONCAT)
> stack_parm = reg;
> else
> - /* This will use or allocate a stack slot that we'd rather
> - avoid. FIXME: Could we avoid it in more cases? */
> - target_reg = reg;
> + {
> + target_reg = reg;
> + /* Avoid allocating a stack slot, if there isn't one
> + preallocated by the ABI. It might seem like we should
> + always prefer a pseudo, but converting between
> + floating-point and integer modes goes through the stack
> + on various machines, so it's better to use the reserved
> + stack slot than to risk wasting it and allocating more
> + for the conversion. */
> + if (stack_parm == NULL_RTX)
> + {
> + int save = generating_concat_p;
> + generating_concat_p = 0;
> + stack_parm = gen_reg_rtx (mode);
> + generating_concat_p = save;
> + }
> + }
> data->stack_parm = NULL;
> }
>
> @@ -2938,7 +2953,9 @@ assign_parm_setup_block (struct assign_parm_data_all *all,
> mem = validize_mem (copy_rtx (stack_parm));
>
> /* Handle values in multiple non-contiguous locations. */
> - if (GET_CODE (entry_parm) == PARALLEL)
> + if (GET_CODE (entry_parm) == PARALLEL && !MEM_P (mem))
> + emit_group_store (mem, entry_parm, data->passed_type, size);
> + else if (GET_CODE (entry_parm) == PARALLEL)
> {
> push_to_sequence2 (all->first_conversion_insn,
> all->last_conversion_insn);
> @@ -2946,6 +2963,7 @@ assign_parm_setup_block (struct assign_parm_data_all *all,
> all->first_conversion_insn = get_insns ();
> all->last_conversion_insn = get_last_insn ();
> end_sequence ();
> + in_conversion_seq = true;
> }
>
> else if (size == 0)
> @@ -3025,11 +3043,22 @@ assign_parm_setup_block (struct assign_parm_data_all *all,
> all->first_conversion_insn = get_insns ();
> all->last_conversion_insn = get_last_insn ();
> end_sequence ();
> + in_conversion_seq = true;
> }
>
> if (target_reg)
> {
> - emit_move_insn (target_reg, stack_parm);
> + if (!in_conversion_seq)
> + emit_move_insn (target_reg, stack_parm);
> + else
> + {
> + push_to_sequence2 (all->first_conversion_insn,
> + all->last_conversion_insn);
> + emit_move_insn (target_reg, stack_parm);
> + all->first_conversion_insn = get_insns ();
> + all->last_conversion_insn = get_last_insn ();
> + end_sequence ();
> + }
> stack_parm = target_reg;
> }
>
>
>
> --
> Alexandre Oliva, freedom fighter http://FSFLA.org/~lxoliva/
> You must be the change you wish to see in the world. -- Gandhi
> Be Free! -- http://FSFLA.org/ FSF Latin America board member
> Free Software Evangelist|Red Hat Brasil GNU Toolchain Engineer
next prev parent reply other threads:[~2015-11-05 13:44 UTC|newest]
Thread overview: 127+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-27 18:04 Alexandre Oliva
2015-03-27 18:11 ` Alexandre Oliva
2015-03-28 19:22 ` Alexandre Oliva
2015-03-31 5:11 ` Jeff Law
2015-04-03 13:17 ` Alexandre Oliva
2015-04-06 16:08 ` Jeff Law
2015-04-24 1:56 ` Alexandre Oliva
2015-04-27 11:39 ` Richard Biener
2015-06-06 5:12 ` Alexandre Oliva
2015-06-08 8:16 ` Richard Biener
2015-06-09 8:58 ` Christophe Lyon
2015-06-10 0:28 ` Alexandre Oliva
2015-06-10 13:36 ` Richard Biener
2015-07-16 7:58 ` Alexandre Oliva
2015-07-16 8:50 ` Richard Biener
2015-07-16 21:33 ` Alexandre Oliva
2015-07-18 8:26 ` Alexandre Oliva
2015-07-21 13:25 ` Richard Biener
2015-07-22 17:13 ` Alexandre Oliva
2015-07-22 17:43 ` Alexandre Oliva
2015-07-23 11:04 ` Richard Biener
2015-07-23 15:42 ` Alexandre Oliva
2015-07-23 20:35 ` Segher Boessenkool
2015-07-23 21:24 ` H.J. Lu
2015-07-23 22:11 ` H.J. Lu
2015-07-24 1:31 ` David Edelsohn
2015-07-24 5:08 ` H.J. Lu
2015-07-24 9:26 ` Richard Biener
2015-07-24 12:50 ` H.J. Lu
2015-07-24 20:20 ` Alexandre Oliva
2015-07-25 2:37 ` David Edelsohn
2015-07-27 22:16 ` Alexandre Oliva
2015-07-27 22:31 ` H.J. Lu
2015-07-24 18:51 ` Alexandre Oliva
2015-07-24 19:12 ` H.J. Lu
2015-07-24 19:31 ` David Edelsohn
2015-07-24 20:43 ` Alexandre Oliva
2015-07-24 20:47 ` Alexandre Oliva
2015-07-24 21:53 ` H.J. Lu
2015-07-25 7:17 ` Richard Biener
2015-07-29 20:52 ` Alexandre Oliva
2015-07-29 21:06 ` H.J. Lu
2015-07-30 17:47 ` H.J. Lu
2015-08-03 23:46 ` Alexandre Oliva
2015-08-04 9:48 ` Richard Biener
2015-08-05 0:39 ` Alexandre Oliva
2015-08-05 9:14 ` Richard Biener
2015-08-05 23:03 ` Alexandre Oliva
2015-08-10 8:24 ` James Greenhalgh
2015-08-10 15:14 ` Jeff Law
2015-08-11 4:53 ` Patrick Marlier
2015-08-14 19:03 ` Alexandre Oliva
2015-08-15 8:57 ` Andreas Schwab
2015-08-16 13:00 ` Alexandre Oliva
[not found] ` <m2k2sv8s21.fsf@linux-m68k.org>
2015-08-17 5:05 ` Alexandre Oliva
2015-08-17 9:29 ` Kyrill Tkachov
2015-08-17 16:23 ` Andrew Pinski
2015-08-18 16:18 ` Kyrill Tkachov
2015-08-16 16:42 ` Andreas Schwab
2015-08-17 2:57 ` Alexandre Oliva
2015-08-17 8:23 ` Andreas Schwab
2015-08-17 9:21 ` Andreas Schwab
2015-08-17 11:58 ` Alexandre Oliva
2015-08-17 7:48 ` Christophe Lyon
2015-08-17 12:43 ` Alexandre Oliva
2015-08-17 13:39 ` Christophe Lyon
2015-08-18 6:53 ` Alexandre Oliva
2015-08-19 6:50 ` Alexandre Oliva
2015-08-19 10:17 ` Richard Biener
2015-08-19 13:35 ` Andreas Schwab
2015-08-19 13:45 ` Andreas Schwab
2015-08-19 17:48 ` Alexandre Oliva
2015-08-20 1:44 ` Alexandre Oliva
2015-08-20 17:03 ` Jeff Law
2015-08-21 7:57 ` Alexandre Oliva
2015-08-21 8:38 ` Richard Biener
2015-08-21 12:17 ` Andreas Schwab
2015-08-21 8:11 ` Alexandre Oliva
2015-08-21 8:37 ` Richard Biener
2015-09-02 17:09 ` Alan Lawrence
2015-09-02 22:34 ` Alexandre Oliva
2015-09-03 10:58 ` Alan Lawrence
2015-09-18 15:49 ` Alan Lawrence
2015-09-23 20:44 ` Alexandre Oliva
2015-09-25 11:39 ` Richard Biener
2015-10-09 5:26 ` [PR67828] don't unswitch loops on undefined SSA values (was: Re: [PR64164] drop copyrename, integrate into expand) Alexandre Oliva
2015-10-09 9:35 ` Richard Biener
2015-10-09 5:36 ` [PR67766] reorder return value copying from PARALLELs and CONCATs " Alexandre Oliva
2015-10-09 7:33 ` [PR67891] drop is_gimple_reg test from set_parm_rtl (was: [PR67766] reorder return value copying from PARALLELs and CONCATs) Alexandre Oliva
2015-10-09 9:40 ` Richard Biener
2015-10-10 13:20 ` [PR67891] drop is_gimple_reg test from set_parm_rtl Alexandre Oliva
2015-10-12 10:22 ` Richard Biener
2015-10-14 3:25 ` Alexandre Oliva
2015-10-14 9:28 ` Richard Biener
2015-11-03 1:11 ` Alexandre Oliva
2015-11-03 3:14 ` Jeff Law
2015-11-03 4:29 ` Alexandre Oliva
2022-10-17 12:08 ` Tag 'gcc/gimple-expr.cc:mark_addressable_2' as 'static' (was: [PR67891] drop is_gimple_reg test from set_parm_rtl) Thomas Schwinge
2015-10-09 9:36 ` [PR67766] reorder return value copying from PARALLELs and CONCATs (was: Re: [PR64164] drop copyrename, integrate into expand) Richard Biener
2015-09-29 11:31 ` [PR64164] drop copyrename, integrate into expand Szabolcs Nagy
2015-10-07 22:37 ` Alexandre Oliva
2015-10-08 10:00 ` Richard Biener
2015-10-09 21:10 ` Jeff Law
2015-11-05 5:09 ` Alexandre Oliva
2015-11-05 13:44 ` Richard Biener [this message]
2015-11-10 15:31 ` Alan Lawrence
2015-11-10 22:59 ` Alexandre Oliva
2015-11-10 23:43 ` Jeff Law
2015-11-11 18:10 ` Alexandre Oliva
2015-11-13 6:33 ` Jeff Law
2015-11-17 0:07 ` Alexandre Oliva
2015-11-24 5:41 ` Jeff Law
2015-07-24 18:21 ` Alexandre Oliva
2015-07-29 20:32 ` Alexandre Oliva
2015-04-29 3:51 ` Jeff Law
2015-03-31 6:55 ` Steven Bosscher
2015-03-31 13:30 ` Richard Biener
2015-03-31 14:06 ` Richard Biener
2015-04-03 13:30 ` Alexandre Oliva
2015-04-06 15:57 ` Jeff Law
2015-12-04 12:45 ` Dominik Vogt
2015-06-09 16:19 David Edelsohn
2015-06-09 18:36 ` Alexandre Oliva
2015-06-09 20:24 ` Alexandre Oliva
2015-06-09 20:59 ` Jakub Jelinek
2015-06-09 21:36 ` Eric Botcazou
2015-06-09 21:38 ` David Edelsohn
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAFiYyc1HA-pKA4EHHar08dUUdQ1a16gCD3m4d2rKFBPS2ALc5w@mail.gmail.com \
--to=richard.guenther@gmail.com \
--cc=James.Greenhalgh@arm.com \
--cc=alan.lawrence@arm.com \
--cc=aoliva@redhat.com \
--cc=christophe.lyon@linaro.org \
--cc=dje.gcc@gmail.com \
--cc=ebotcazou@adacore.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=hjl.tools@gmail.com \
--cc=law@redhat.com \
--cc=segher@kernel.crashing.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).