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] [PR rtl-optimization/65618] Fix MIPS ADA bootstrap failure


Hi,

On 19/12/16 21:43, Jeff Law wrote:
> On 12/19/2016 08:44 AM, James Cowgill wrote:
>> 2016-12-16  James Cowgill  <James.Cowgill@imgtec.com>
>>
>>     PR rtl-optimization/65618
>>     * emit-rtl.c (try_split): Update "after" when moving a
>>     NOTE_INSN_CALL_ARG_LOCATION.
>>
>> diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
>> index 7de17454037..6be124ac038 100644
>> --- a/gcc/emit-rtl.c
>> +++ b/gcc/emit-rtl.c
>> @@ -3742,6 +3742,11 @@ try_split (rtx pat, rtx_insn *trial, int last)
>>             next = NEXT_INSN (next))
>>          if (NOTE_KIND (next) == NOTE_INSN_CALL_ARG_LOCATION)
>>            {
>> +            /* Advance after to the next instruction if it is about to
>> +               be removed.  */
>> +            if (after == next)
>> +              after = NEXT_INSN (after);
>> +
>>              remove_insn (next);
>>              add_insn_after (next, insn, NULL);
>>              break;
>>
> So the thing I don't like when looking at this code is we set AFTER
> immediately upon entry to try_split.  But we don't use it until near the
> very end of try_split.  That's just asking for trouble.
> 
> Can we reasonably initialize AFTER just before it's used?

I wasn't sure but looking closer I think that would be fine. This patch
also works and does what Richard Sandiford suggested in the PR.

2016-12-20  James Cowgill  <James.Cowgill@imgtec.com>

	PR rtl-optimization/65618
	* emit-rtl.c (try_split): Move initialization of "before" and
	"after" to just before the call to emit_insn_after_setloc.

diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
index 7de17454037..bdc984c65cf 100644
--- a/gcc/emit-rtl.c
+++ b/gcc/emit-rtl.c
@@ -3643,8 +3643,7 @@ mark_label_nuses (rtx x)
 rtx_insn *
 try_split (rtx pat, rtx_insn *trial, int last)
 {
-  rtx_insn *before = PREV_INSN (trial);
-  rtx_insn *after = NEXT_INSN (trial);
+  rtx_insn *before, *after;
   rtx note;
   rtx_insn *seq, *tem;
   int probability;
@@ -3818,6 +3817,9 @@ try_split (rtx pat, rtx_insn *trial, int last)
 	}
     }
 
+  before = PREV_INSN (trial);
+  after = NEXT_INSN (trial);
+
   tem = emit_insn_after_setloc (seq, trial, INSN_LOCATION (trial));
 
   delete_insn (trial);

Thanks,
James


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