Patchwork Fix recently introduced -fcompare-debug failures in the scheduler (PR rtl-optimization/54792)

login
register
mail settings
Submitter Jakub Jelinek
Date Oct. 3, 2012, 1:01 p.m.
Message ID <20121003130147.GT1787@tucnak.redhat.com>
Download mbox | patch
Permalink /patch/188760/
State New
Headers show

Comments

Jakub Jelinek - Oct. 3, 2012, 1:01 p.m.
Hi!

While bootstrapping the PR54519 patches last night, I've noticed a
comparison failure on i686-linux.  The problem was -g vs. -g0
swapping two instructions in tree-inline.o, caused by find_modifiable_mems
scanning [head, tail) instead of [head, tail] sequence of instructions.
Without -g0 on tree-inline.c we had a MEM load as last insn in a bb (i.e.
tail) which wasn't processed by find_modifiable_mems, while with -g
there were some DEBUG_INSNs after it and find_mems was called on it
and triggerring the optimization.

Fixed by scanning also the tail insn, the same way as other spots in
sched-deps.c handle [head, tail] walk.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

2012-10-03  Jakub Jelinek  <jakub@redhat.com>

	PR rtl-optimization/54792
	* sched-deps.c (find_modifiable_mems): Scan also TAIL insn.


	Jakub
Vladimir Makarov - Oct. 3, 2012, 2:08 p.m.
On 12-10-03 9:01 AM, Jakub Jelinek wrote:
> Hi!
>
> While bootstrapping the PR54519 patches last night, I've noticed a
> comparison failure on i686-linux.  The problem was -g vs. -g0
> swapping two instructions in tree-inline.o, caused by find_modifiable_mems
> scanning [head, tail) instead of [head, tail] sequence of instructions.
> Without -g0 on tree-inline.c we had a MEM load as last insn in a bb (i.e.
> tail) which wasn't processed by find_modifiable_mems, while with -g
> there were some DEBUG_INSNs after it and find_mems was called on it
> and triggerring the optimization.
>
> Fixed by scanning also the tail insn, the same way as other spots in
> sched-deps.c handle [head, tail] walk.
>
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
>
> 2012-10-03  Jakub Jelinek  <jakub@redhat.com>
>
> 	PR rtl-optimization/54792
> 	* sched-deps.c (find_modifiable_mems): Scan also TAIL insn.
>
>
Yes.  Thanks, Jakub.

Patch

--- gcc/sched-deps.c.jj	2012-10-01 10:08:43.000000000 +0200
+++ gcc/sched-deps.c	2012-10-03 11:35:57.215589982 +0200
@@ -4816,10 +4816,10 @@  find_mem (struct mem_inc_info *mii, rtx
 void
 find_modifiable_mems (rtx head, rtx tail)
 {
-  rtx insn;
+  rtx insn, next_tail = NEXT_INSN (tail);
   int success_in_block = 0;
 
-  for (insn = head; insn != tail; insn = NEXT_INSN (insn))
+  for (insn = head; insn != next_tail; insn = NEXT_INSN (insn))
     {
       struct mem_inc_info mii;