This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] match_asm_constraints: Use copy_rtx where needed (PR88001)


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]