public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Andrey Belevantsev <abel@ispras.ru>
To: GCC Patches <gcc-patches@gcc.gnu.org>
Cc: Alexander Monakov <amonakov@ispras.ru>
Subject: [03/05] Fix PR 66660
Date: Mon, 14 Mar 2016 09:36:00 -0000	[thread overview]
Message-ID: <eb668250-3027-8d05-0ade-cfbd0c4a363c@ispras.ru> (raw)
In-Reply-To: <d534c458-8456-51f7-2963-5d1faf112ffe@ispras.ru>

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

Hello,

We speculate an insn in the PR but we do not make a check for it though we 
should.  The thing that broke this was the fix for PR 45472.  In that pr, 
we have moved a volatile insn too far up because we failed to merge the 
bits describing its volatility when we have processed a control flow split. 
  The code to propagate the insn pattern with the insn merging was added 
when the volatility of the two insns from the both split branches differ. 
However, the volatility of the speculated insn and its original differ: the 
original insn may trap while the speculated version may not.  Thus, we 
replace a speculative pattern with the original one per the PR 45472 fix 
for no reason.

The patch for this problem just limits the original fix for PR 45472 to 
apply for non-speculative insns only.  There is no test as it is not so 
easy to construct one -- we could count the number of speculation check in 
the resulting assembly but there is no way to force speculation to happen.

Ok for trunk?

gcc/

2016-03-14  Andrey Belevantsev  <abel@ispras.ru>

     PR target/66660
     * sel-sched-ir.c (merge_expr): Do not propagate trap bits into 
speculative insns.

Best,
Andrey

[-- Attachment #2: 03-pr66660.diff --]
[-- Type: text/x-patch, Size: 1303 bytes --]

commit 53ef39496acc26cc0021555e403068e93343aa20
Author: Andrey Belevantsev <abel@ispras.ru>
Date:   Wed Jan 27 17:20:27 2016 +0300

    Fix pr66660: do not propagate trap bits into speculative insns

diff --git a/gcc/sel-sched-ir.c b/gcc/sel-sched-ir.c
index e181cb9..ec59280 100644
--- a/gcc/sel-sched-ir.c
+++ b/gcc/sel-sched-ir.c
@@ -1871,12 +1871,12 @@ merge_expr (expr_t to, expr_t from, insn_t split_point)
   /* Make sure that speculative pattern is propagated into exprs that
      have non-speculative one.  This will provide us with consistent
      speculative bits and speculative patterns inside expr.  */
-  if ((EXPR_SPEC_DONE_DS (from) != 0
-       && EXPR_SPEC_DONE_DS (to) == 0)
-      /* Do likewise for volatile insns, so that we always retain
-	 the may_trap_p bit on the resulting expression.  */
-      || (VINSN_MAY_TRAP_P (EXPR_VINSN (from))
-	  && !VINSN_MAY_TRAP_P (EXPR_VINSN (to))))
+  if (EXPR_SPEC_DONE_DS (to) == 0
+      && (EXPR_SPEC_DONE_DS (from) != 0
+	  /* Do likewise for volatile insns, so that we always retain
+	     the may_trap_p bit on the resulting expression.  */
+	  || (VINSN_MAY_TRAP_P (EXPR_VINSN (from))
+	      && !VINSN_MAY_TRAP_P (EXPR_VINSN (to)))))
     change_vinsn_in_expr (to, EXPR_VINSN (from));
 
   merge_expr_data (to, from, split_point);

  parent reply	other threads:[~2016-03-14  9:36 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-14  9:11 Various selective scheduling fixes Andrey Belevantsev
2016-03-14  9:22 ` [01/05] Fix PR 64411 Andrey Belevantsev
2016-03-14 16:23   ` Alexander Monakov
2016-03-14 16:45     ` Bernd Schmidt
2016-03-15 15:43       ` Andrey Belevantsev
2016-03-14  9:32 ` [02/05] Fix PR 63384 Andrey Belevantsev
2016-03-14 17:13   ` Alexander Monakov
2016-03-15 17:30   ` Marek Polacek
2016-03-15 17:44     ` Alexander Monakov
2016-03-15 18:00       ` Andrey Belevantsev
2016-03-15 18:12         ` Alexander Monakov
2016-03-14  9:36 ` Andrey Belevantsev [this message]
2016-03-14 17:37   ` [03/05] Fix PR 66660 Alexander Monakov
2016-03-14  9:40 ` [04/05] Fix PR 69032 Andrey Belevantsev
2016-03-14 18:15   ` Alexander Monakov
2016-03-14  9:53 ` [05/05] Fix PR 69102 Andrey Belevantsev
2016-03-15 15:55   ` Andrey Belevantsev
2016-03-17 16:39     ` Jeff Law
2016-03-31 14:55 ` Various selective scheduling fixes Andrey Belevantsev
2016-04-01  7:33   ` Christophe Lyon
2016-04-01  8:55     ` Andrey Belevantsev
2016-04-01 13:09       ` Christophe Lyon
2016-04-01 13:12         ` Kyrill Tkachov
2016-04-01 13:26           ` Christophe Lyon
2016-04-01 16:19             ` Jeff Law
2016-04-01 20:08               ` Christophe Lyon

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=eb668250-3027-8d05-0ade-cfbd0c4a363c@ispras.ru \
    --to=abel@ispras.ru \
    --cc=amonakov@ispras.ru \
    --cc=gcc-patches@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).