public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Andrey Belevantsev <abel@ispras.ru>
To: Vladimir Makarov <vmakarov@redhat.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] Fix PR 46521 and 46522 (remnants of PR45352)
Date: Fri, 24 Dec 2010 16:54:00 -0000	[thread overview]
Message-ID: <4D146BD6.1000100@ispras.ru> (raw)
In-Reply-To: <4D10E483.90205@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1101 bytes --]

> On 12/21/2010 10:58 AM, Andrey Belevantsev wrote:
>
>> 2010-12-21 Andrey Belevantsev <abel@ispras.ru>
>>
>> PR rtl-optimization/45352
>> PR rtl-optimization/46521
>> PR rtl-optimization/46522
>> * sel-sched.c (reset_sched_cycles_in_current_ebb): Recheck the DFA state
>> on the last iteration of the advancing loop.
>> (sel_sched_region_1): Propagate the rescheduling bit to the next block
>> also for empty blocks.
Sigh, I have overlooked that we also need to recheck the state when we have 
reached the issue_rate limit (as we agreed on earlier this year), not only 
when we have a data dependency stall.  So the above amendment to the patch 
is needed, bootstrapped and tested on x86-64 with selective scheduler 
enabled.  Ok for trunk and branches?

Andrey

	2010-12-21 Andrey Belevantsev <abel@ispras.ru>
	
	PR rtl-optimization/45352
	* sel-sched.c (reset_sched_cycles_in_current_ebb): Also recheck the DFA state
	in the advancing loop when we have issued issue_rate insns.

gcc/testsuite:

	2010-12-21 Andrey Belevantsev <abel@ispras.ru>
	
	PR rtl-optimization/45352
	gcc.dg/pr45352-3.c: New.

[-- Attachment #2: pr45352-3.diff --]
[-- Type: text/x-patch, Size: 3107 bytes --]

Index: testsuite/gcc.dg/pr45352-3.c
===================================================================
*** testsuite/gcc.dg/pr45352-3.c	(revision 0)
--- testsuite/gcc.dg/pr45352-3.c	(revision 0)
***************
*** 0 ****
--- 1,16 ----
+ /* { dg-do compile { target powerpc*-*-* ia64-*-* x86_64-*-* } } */
+ /* { dg-options "-O -fprofile-generate -fgcse -fno-gcse-lm -fgcse-sm -fno-ivopts -fno-tree-loop-im -ftree-pre -funroll-loops -fno-web -fschedule-insns2 -fselective-scheduling2 -fsel-sched-pipelining" } */
+ 
+ extern volatile float f[];
+ 
+ void foo (void)
+ {
+   int i;
+   for (i = 0; i < 100; i++)
+     f[i] = 0;
+   for (i = 0; i < 100; i++)
+     f[i] = 0;
+   for (i = 0; i < 100; i++)
+     if (f[i])
+       __builtin_abort ();
+ }
Index: sel-sched.c
===================================================================
*** sel-sched.c	(revision 168224)
--- sel-sched.c	(working copy)
*************** reset_sched_cycles_in_current_ebb (void)
*** 6990,6996 ****
      {
        int cost, haifa_cost;
        int sort_p;
!       bool asm_p, real_insn, after_stall;
        int clock;
  
        if (!INSN_P (insn))
--- 6990,6996 ----
      {
        int cost, haifa_cost;
        int sort_p;
!       bool asm_p, real_insn, after_stall, all_issued;
        int clock;
  
        if (!INSN_P (insn))
*************** reset_sched_cycles_in_current_ebb (void)
*** 7026,7033 ****
            haifa_cost = cost;
            after_stall = 1;
          }
!       if (haifa_cost == 0
! 	  && issued_insns == issue_rate)
  	haifa_cost = 1;
        if (haifa_cost > 0)
  	{
--- 7026,7033 ----
            haifa_cost = cost;
            after_stall = 1;
          }
!       all_issued = issued_insns == issue_rate;
!       if (haifa_cost == 0 && all_issued)
  	haifa_cost = 1;
        if (haifa_cost > 0)
  	{
*************** reset_sched_cycles_in_current_ebb (void)
*** 7055,7065 ****
                  break;
  
                /* When the data dependency stall is longer than the DFA stall,
!                  it could be that after the longer stall the insn will again
                   become unavailable  to the DFA restrictions.  Looks strange
                   but happens e.g. on x86-64.  So recheck DFA on the last
                   iteration.  */
!               if (after_stall
                    && real_insn
                    && haifa_cost == 0)
                  haifa_cost = estimate_insn_cost (insn, curr_state);
--- 7055,7066 ----
                  break;
  
                /* When the data dependency stall is longer than the DFA stall,
!                  and when we have issued exactly issue_rate insns and stalled,
!                  it could be that after this longer stall the insn will again
                   become unavailable  to the DFA restrictions.  Looks strange
                   but happens e.g. on x86-64.  So recheck DFA on the last
                   iteration.  */
!               if ((after_stall || all_issued)
                    && real_insn
                    && haifa_cost == 0)
                  haifa_cost = estimate_insn_cost (insn, curr_state);

  reply	other threads:[~2010-12-24  9:46 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-22  8:52 [PATCH] Fix PR45352 Andrey Belevantsev
2010-11-03 12:18 ` Andrey Belevantsev
2010-11-05 20:31   ` Vladimir Makarov
2010-12-21 17:01     ` [PATCH] Fix PR 46521 and 46522 (remnants of PR45352) Andrey Belevantsev
2010-12-21 18:52       ` Vladimir Makarov
2010-12-24 16:54         ` Andrey Belevantsev [this message]
2011-01-12  9:11           ` Andrey Belevantsev
2011-01-13  1:37             ` Vladimir Makarov
2010-11-08 14:28   ` [PATCH] Fix PR45352 H.J. Lu
2010-11-17 12:52     ` Andrey Belevantsev
2010-11-18 14:36     ` H.J. Lu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4D146BD6.1000100@ispras.ru \
    --to=abel@ispras.ru \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=vmakarov@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).