public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] lra: A multiple_sets is not a simple_move_p (PR73650)
@ 2016-08-12 18:38 Segher Boessenkool
  2016-08-15 15:37 ` Jeff Law
  0 siblings, 1 reply; 3+ messages in thread
From: Segher Boessenkool @ 2016-08-12 18:38 UTC (permalink / raw)
  To: gcc-patches; +Cc: vmakarov, Segher Boessenkool

Hi!

In the PR we have a PARALLEL of a move and a compare (a "mr." instruction).
The compare is dead, so single_set on it returns just the move.  Then,
simple_move_p returns true; but the instruction does need reloads in this
case.  This patch solves this by making simple_move_p return false for
every multiple_sets instruction.

Bootstrapped and regression checked on powerpc64-linux (-m64,-m32).
Is this okay for trunk?


Segher


2016-08-12  Segher Boessenkool  <segher@kernel.crashing.org>

	PR rtl-optimization/73650
	* lra-constraints.c (simple_move_p): If the insn is multiple_sets
	it is not a simple move.

---
 gcc/lra-constraints.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/gcc/lra-constraints.c b/gcc/lra-constraints.c
index 880eee0..a5dca86 100644
--- a/gcc/lra-constraints.c
+++ b/gcc/lra-constraints.c
@@ -3452,6 +3452,13 @@ simple_move_p (void)
   lra_assert (curr_insn_set != NULL_RTX);
   dest = SET_DEST (curr_insn_set);
   src = SET_SRC (curr_insn_set);
+
+  /* If the instruction has multiple sets we need to process it even if it
+     is single_set.  This can happen if one or more of the SETs are dead.
+     See PR73650.  */
+  if (multiple_sets (curr_insn))
+    return false;
+
   return ((dclass = get_op_class (dest)) != NO_REGS
 	  && (sclass = get_op_class (src)) != NO_REGS
 	  /* The backend guarantees that register moves of cost 2
-- 
1.9.3

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] lra: A multiple_sets is not a simple_move_p (PR73650)
  2016-08-12 18:38 [PATCH] lra: A multiple_sets is not a simple_move_p (PR73650) Segher Boessenkool
@ 2016-08-15 15:37 ` Jeff Law
  2016-08-15 16:12   ` Segher Boessenkool
  0 siblings, 1 reply; 3+ messages in thread
From: Jeff Law @ 2016-08-15 15:37 UTC (permalink / raw)
  To: Segher Boessenkool, gcc-patches; +Cc: vmakarov

On 08/12/2016 12:38 PM, Segher Boessenkool wrote:
> Hi!
>
> In the PR we have a PARALLEL of a move and a compare (a "mr." instruction).
> The compare is dead, so single_set on it returns just the move.  Then,
> simple_move_p returns true; but the instruction does need reloads in this
> case.  This patch solves this by making simple_move_p return false for
> every multiple_sets instruction.
>
> Bootstrapped and regression checked on powerpc64-linux (-m64,-m32).
> Is this okay for trunk?
>
>
> Segher
>
>
> 2016-08-12  Segher Boessenkool  <segher@kernel.crashing.org>
>
> 	PR rtl-optimization/73650
> 	* lra-constraints.c (simple_move_p): If the insn is multiple_sets
> 	it is not a simple move.
OK.

Though I do wonder if it would be advantageous to try and rewrite such 
insns.

jeff

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] lra: A multiple_sets is not a simple_move_p (PR73650)
  2016-08-15 15:37 ` Jeff Law
@ 2016-08-15 16:12   ` Segher Boessenkool
  0 siblings, 0 replies; 3+ messages in thread
From: Segher Boessenkool @ 2016-08-15 16:12 UTC (permalink / raw)
  To: Jeff Law; +Cc: gcc-patches, vmakarov

On Mon, Aug 15, 2016 at 09:37:34AM -0600, Jeff Law wrote:
> On 08/12/2016 12:38 PM, Segher Boessenkool wrote:
> >In the PR we have a PARALLEL of a move and a compare (a "mr." instruction).
> >The compare is dead, so single_set on it returns just the move.  Then,
> >simple_move_p returns true; but the instruction does need reloads in this
> >case.  This patch solves this by making simple_move_p return false for
> >every multiple_sets instruction.
> >
> >Bootstrapped and regression checked on powerpc64-linux (-m64,-m32).
> >Is this okay for trunk?
> >
> >
> >Segher
> >
> >
> >2016-08-12  Segher Boessenkool  <segher@kernel.crashing.org>
> >
> >	PR rtl-optimization/73650
> >	* lra-constraints.c (simple_move_p): If the insn is multiple_sets
> >	it is not a simple move.
> OK.
> 
> Though I do wonder if it would be advantageous to try and rewrite such 
> insns.

Ah, I didn't mention that.  I tried that, using code similar to
eliminate_regs_in_insn (lra-eliminations.c, around line 1080, after the
comment starting with "/* First see if this insn remains valid when").
This works, but the REG_UNUSED still remains, and it seems something later
then deletes the remaining insn.

Cleaning up the notes requires some nasty code.

The multiple_sets fits nicely in simple_move_p, which says
/* Return true if the current move insn does not need processing as we
   already know that it satisfies its constraints.  */
(we could of course move all this to the caller).


Segher

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-08-15 16:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-12 18:38 [PATCH] lra: A multiple_sets is not a simple_move_p (PR73650) Segher Boessenkool
2016-08-15 15:37 ` Jeff Law
2016-08-15 16:12   ` Segher Boessenkool

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).