public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] match_asm_constraints: Use copy_rtx where needed (PR88001)
@ 2018-12-12 20:22 Segher Boessenkool
  2018-12-13 18:09 ` Jeff Law
  0 siblings, 1 reply; 4+ messages in thread
From: Segher Boessenkool @ 2018-12-12 20:22 UTC (permalink / raw)
  To: gcc-patches; +Cc: Segher Boessenkool

The new insn here (temporarily) illegally shares RTL.  This fixes it.

Tested with an ARC cross, and regstrapped on powerpc64-linux {-m32,-m64}.
Is this okay for trunk?


Segher


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

	PR rtl-optimization/88001
	* function.c (match_asm_constraints_1): Don't invalidly share RTL.

---
 gcc/function.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/function.c b/gcc/function.c
index 69523c1..60e96f3 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -6529,7 +6529,7 @@ match_asm_constraints_1 (rtx_insn *insn, rtx *p_sets, int noutputs)
       output_matched[match] = true;
 
       start_sequence ();
-      emit_move_insn (output, input);
+      emit_move_insn (output, copy_rtx (input));
       insns = get_insns ();
       end_sequence ();
       emit_insn_before (insns, insn);
-- 
1.8.3.1

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

* Re: [PATCH] match_asm_constraints: Use copy_rtx where needed (PR88001)
  2018-12-12 20:22 [PATCH] match_asm_constraints: Use copy_rtx where needed (PR88001) Segher Boessenkool
@ 2018-12-13 18:09 ` Jeff Law
  2018-12-14  8:26   ` Segher Boessenkool
  2018-12-15 12:12   ` Segher Boessenkool
  0 siblings, 2 replies; 4+ messages in thread
From: Jeff Law @ 2018-12-13 18:09 UTC (permalink / raw)
  To: Segher Boessenkool, gcc-patches

On 12/12/18 1:22 PM, Segher Boessenkool wrote:
> The new insn here (temporarily) illegally shares RTL.  This fixes it.
> 
> Tested with an ARC cross, and regstrapped on powerpc64-linux {-m32,-m64}.
> Is this okay for trunk?
> 
> 
> Segher
> 
> 
> 2018-12-12  Segher Boessenkool  <segher@kernel.crashing.org>
> 
> 	PR rtl-optimization/88001
> 	* function.c (match_asm_constraints_1): Don't invalidly share RTL.
> 
> ---
>  gcc/function.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/gcc/function.c b/gcc/function.c
> index 69523c1..60e96f3 100644
> --- a/gcc/function.c
> +++ b/gcc/function.c
> @@ -6529,7 +6529,7 @@ match_asm_constraints_1 (rtx_insn *insn, rtx *p_sets, int noutputs)
>        output_matched[match] = true;
>  
>        start_sequence ();
> -      emit_move_insn (output, input);
> +      emit_move_insn (output, copy_rtx (input));
>        insns = get_insns ();
>        end_sequence ();
>        emit_insn_before (insns, insn);
> 
Presumably INPUT  is already referenced by INSN, thus the potential
invalid sharing via the newly introduced move?

OK.

Jeff

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

* Re: [PATCH] match_asm_constraints: Use copy_rtx where needed (PR88001)
  2018-12-13 18:09 ` Jeff Law
@ 2018-12-14  8:26   ` Segher Boessenkool
  2018-12-15 12:12   ` Segher Boessenkool
  1 sibling, 0 replies; 4+ messages in thread
From: Segher Boessenkool @ 2018-12-14  8:26 UTC (permalink / raw)
  To: Jeff Law; +Cc: gcc-patches

On Thu, Dec 13, 2018 at 11:09:14AM -0700, Jeff Law wrote:
> On 12/12/18 1:22 PM, Segher Boessenkool wrote:
> > The new insn here (temporarily) illegally shares RTL.  This fixes it.
> > 
> > Tested with an ARC cross, and regstrapped on powerpc64-linux {-m32,-m64}.
> > Is this okay for trunk?
> > 
> > 
> > Segher
> > 
> > 
> > 2018-12-12  Segher Boessenkool  <segher@kernel.crashing.org>
> > 
> > 	PR rtl-optimization/88001
> > 	* function.c (match_asm_constraints_1): Don't invalidly share RTL.
> > 
> > ---
> >  gcc/function.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/gcc/function.c b/gcc/function.c
> > index 69523c1..60e96f3 100644
> > --- a/gcc/function.c
> > +++ b/gcc/function.c
> > @@ -6529,7 +6529,7 @@ match_asm_constraints_1 (rtx_insn *insn, rtx *p_sets, int noutputs)
> >        output_matched[match] = true;
> >  
> >        start_sequence ();
> > -      emit_move_insn (output, input);
> > +      emit_move_insn (output, copy_rtx (input));
> >        insns = get_insns ();
> >        end_sequence ();
> >        emit_insn_before (insns, insn);
> > 
> Presumably INPUT  is already referenced by INSN, thus the potential
> invalid sharing via the newly introduced move?

"output" is the output of some asm, and "input" is an input of it, where
the two have to match.  This code just emits a move from the input to the
output, before the asm, and then uses "output" (which always is a reg) as
both input and output.

We cannot just remove input from the asm first, because it may be used in
multiple places in the asm.  And how often does this happen anyway, we
copy_rtx many things all over the place :-)

> OK.

Thanks, committing.


Segher

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

* Re: [PATCH] match_asm_constraints: Use copy_rtx where needed (PR88001)
  2018-12-13 18:09 ` Jeff Law
  2018-12-14  8:26   ` Segher Boessenkool
@ 2018-12-15 12:12   ` Segher Boessenkool
  1 sibling, 0 replies; 4+ messages in thread
From: Segher Boessenkool @ 2018-12-15 12:12 UTC (permalink / raw)
  To: Jeff Law; +Cc: gcc-patches

On Thu, Dec 13, 2018 at 11:09:14AM -0700, Jeff Law wrote:
> On 12/12/18 1:22 PM, Segher Boessenkool wrote:
> > The new insn here (temporarily) illegally shares RTL.  This fixes it.
> > 
> > Tested with an ARC cross, and regstrapped on powerpc64-linux {-m32,-m64}.
> > Is this okay for trunk?
> > 
> > 
> > Segher
> > 
> > 
> > 2018-12-12  Segher Boessenkool  <segher@kernel.crashing.org>
> > 
> > 	PR rtl-optimization/88001
> > 	* function.c (match_asm_constraints_1): Don't invalidly share RTL.
> > 
> > ---
> >  gcc/function.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/gcc/function.c b/gcc/function.c
> > index 69523c1..60e96f3 100644
> > --- a/gcc/function.c
> > +++ b/gcc/function.c
> > @@ -6529,7 +6529,7 @@ match_asm_constraints_1 (rtx_insn *insn, rtx *p_sets, int noutputs)
> >        output_matched[match] = true;
> >  
> >        start_sequence ();
> > -      emit_move_insn (output, input);
> > +      emit_move_insn (output, copy_rtx (input));
> >        insns = get_insns ();
> >        end_sequence ();
> >        emit_insn_before (insns, insn);
> > 
> Presumably INPUT  is already referenced by INSN, thus the potential
> invalid sharing via the newly introduced move?
> 
> OK.

I backported this to 8 and 7.  Forgot to ask first, whoops :-/


Segher

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

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

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-12 20:22 [PATCH] match_asm_constraints: Use copy_rtx where needed (PR88001) Segher Boessenkool
2018-12-13 18:09 ` Jeff Law
2018-12-14  8:26   ` Segher Boessenkool
2018-12-15 12: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).