Message ID | 18b30d3165091109ed6a32d8521ecaa1e6676fd7.1544645282.git.segher@kernel.crashing.org |
---|---|
State | New |
Headers | show |
Series | match_asm_constraints: Use copy_rtx where needed (PR88001) | expand |
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
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
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
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);