public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "abel at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug rtl-optimization/52203] ICE: in reset_sched_cycles_in_current_ebb, at sel-sched.c:7136 with -fsel-sched-pipelining -fselective-scheduling2 and other custom flags
Date: Mon, 13 Feb 2012 08:49:00 -0000	[thread overview]
Message-ID: <bug-52203-4-gqV6w9QMaf@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-52203-4@http.gcc.gnu.org/bugzilla/>

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52203

--- Comment #2 from Andrey Belevantsev <abel at gcc dot gnu.org> 2012-02-13 08:48:35 UTC ---
Well, in this case the insn is vcvtps2pd (from avx_cvtps2pd256 and
*avx_cvtps2pd256_2 patterns) but not having a reservation looks correct as the
manual says "decode type -- microcode".  Uros, is that right?  In this case,
the below fixes the test for me (and I was stupid enough not to do this in the
first place when this bug stream just started...  However, we did fix some real
bugs.)

iff --git a/gcc/sel-sched.c b/gcc/sel-sched.c
index 2af01ae..2829f60 100644
--- a/gcc/sel-sched.c
+++ b/gcc/sel-sched.c
@@ -4265,9 +4265,10 @@ invoke_aftermath_hooks (fence_t fence, rtx best_insn,
int issue_more)
   return issue_more;
 }

-/* Estimate the cost of issuing INSN on DFA state STATE.  */
+/* Estimate the cost of issuing INSN on DFA state STATE.  Write to PEMPTY
+   true when INSN does not change the processor state.  */
 static int
-estimate_insn_cost (rtx insn, state_t state)
+estimate_insn_cost (rtx insn, state_t state, bool *pempty)
 {
   static state_t temp = NULL;
   int cost;
@@ -4277,6 +4278,8 @@ estimate_insn_cost (rtx insn, state_t state)

   memcpy (temp, state, dfa_state_size);
   cost = state_transition (temp, insn);
+  if (pempty)
+    *pempty = (memcmp (temp, state, dfa_state_size) == 0);

   if (cost < 0)
     return 0;
@@ -4307,7 +4310,7 @@ get_expr_cost (expr_t expr, fence_t fence)
        return 0;
     }
   else
-    return estimate_insn_cost (insn, FENCE_STATE (fence));
+    return estimate_insn_cost (insn, FENCE_STATE (fence), NULL);
 }

 /* Find the best insn for scheduling, either via max_issue or just take
@@ -7020,7 +7023,7 @@ reset_sched_cycles_in_current_ebb (void)
     {
       int cost, haifa_cost;
       int sort_p;
-      bool asm_p, real_insn, after_stall, all_issued;
+      bool asm_p, real_insn, after_stall, all_issued, empty;
       int clock;

       if (!INSN_P (insn))
@@ -7047,7 +7050,7 @@ reset_sched_cycles_in_current_ebb (void)
            haifa_cost = 0;
        }
       else
-        haifa_cost = estimate_insn_cost (insn, curr_state);
+        haifa_cost = estimate_insn_cost (insn, curr_state, &empty);

       /* Stall for whatever cycles we've stalled before.  */
       after_stall = 0;
@@ -7081,7 +7084,7 @@ reset_sched_cycles_in_current_ebb (void)
               if (!after_stall
                   && real_insn
                   && haifa_cost > 0
-                  && estimate_insn_cost (insn, curr_state) == 0)
+                  && estimate_insn_cost (insn, curr_state, NULL) == 0)
                 break;

               /* When the data dependency stall is longer than the DFA stall,
@@ -7093,7 +7096,7 @@ reset_sched_cycles_in_current_ebb (void)
               if ((after_stall || all_issued)
                   && real_insn
                   && haifa_cost == 0)
-                haifa_cost = estimate_insn_cost (insn, curr_state);
+                haifa_cost = estimate_insn_cost (insn, curr_state, NULL);
             }

          haifa_clock += i;
@@ -7125,7 +7128,8 @@ reset_sched_cycles_in_current_ebb (void)
       if (real_insn)
        {
          cost = state_transition (curr_state, insn);
-         issued_insns++;
+         if (!empty)
+           issued_insns++;

           if (sched_verbose >= 2)
            {


  parent reply	other threads:[~2012-02-13  8:49 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-10 22:19 [Bug rtl-optimization/52203] New: " zsojka at seznam dot cz
2012-02-10 22:43 ` [Bug rtl-optimization/52203] " steven at gcc dot gnu.org
2012-02-11 12:53 ` abel at gcc dot gnu.org
2012-02-13  8:49 ` abel at gcc dot gnu.org
2012-02-13  8:49 ` abel at gcc dot gnu.org [this message]
2012-02-13 15:54 ` ubizjak at gmail dot com
2012-02-13 16:01 ` ubizjak at gmail dot com
2012-02-13 16:02 ` ubizjak at gmail dot com
2012-02-13 21:14 ` steven at gcc dot gnu.org
2012-02-14  6:57 ` abel at gcc dot gnu.org
2012-03-07 12:01 ` abel at gcc dot gnu.org
2012-03-07 12:03 ` abel at gcc dot gnu.org
2012-04-13  9:37 ` abel at gcc dot gnu.org

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=bug-52203-4-gqV6w9QMaf@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /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).