From: Alexander Monakov <amonakov@ispras.ru>
To: Andrey Belevantsev <abel@ispras.ru>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [04/05] Fix PR 69032
Date: Mon, 14 Mar 2016 18:15:00 -0000 [thread overview]
Message-ID: <alpine.LNX.2.20.1603142102390.32612@monopod.intra.ispras.ru> (raw)
In-Reply-To: <f134d419-d7d8-b7e4-0e4c-0a4cccfedcea@ispras.ru>
On Mon, 14 Mar 2016, Andrey Belevantsev wrote:
> We fail to find the proper seqno for the fresh bookkeeping copy in this PR.
> The problem is that in get_seqno_by_preds we are iterating over bb from the
> given insn backwards up to the first bb insn. We skip the initial insn when
> iterating over bb, yet we should take seqno from it.
>
> The code in question originally didn't include bb head when iterating, and was
> patched to do so in 2011. The patch was wrong and instead of including bb
> head managed to exclude the original insn itself. By reading the original and
> patched code I've convinced myself that the right fix will be to do what the
> patch intended and include both the initial insn and the bb head in the
> iteration.
>
> Ok for trunk?
>
> gcc/
>
> 2016-03-14 Andrey Belevantsev <abel@ispras.ru>
>
> PR rtl-optimization/69032
> * sel-sched-ir.c (get_seqno_by_preds): Include both tmp and head when
> looping backwards over basic block insns.
"both 'insn' and 'head'" (not tmp).
> diff --git a/gcc/sel-sched-ir.c b/gcc/sel-sched-ir.c
> index ec59280..c1a9e55 100644
> --- a/gcc/sel-sched-ir.c
> +++ b/gcc/sel-sched-ir.c
> @@ -4103,11 +4103,14 @@ get_seqno_by_preds (rtx_insn *insn)
> insn_t *preds;
> int n, i, seqno;
>
> - while (tmp != head)
> + /* Loop backwards from insn to head including both. */
"from INSN to HEAD" (uppercase).
The following structure is equivalent, but would look a bit more canonical:
for (rtx_insn *tmp = insn; ; tmp = PREV_INSN (tmp))
{
if (INSN_P (tmp))
return INSN_SEQNO (tmp);
if (tmp == head)
break;
}
> + while (1)
> {
> - tmp = PREV_INSN (tmp);
> if (INSN_P (tmp))
> return INSN_SEQNO (tmp);
> + if (tmp == head)
> + break;
> + tmp = PREV_INSN (tmp);
> }
>
> cfg_preds (bb, &preds, &n);
OK with formatting nits fixed ('while'/'for' spelling change at your choice).
Thanks.
Alexander
next prev parent reply other threads:[~2016-03-14 18:15 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 ` [03/05] Fix PR 66660 Andrey Belevantsev
2016-03-14 17:37 ` Alexander Monakov
2016-03-14 9:40 ` [04/05] Fix PR 69032 Andrey Belevantsev
2016-03-14 18:15 ` Alexander Monakov [this message]
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=alpine.LNX.2.20.1603142102390.32612@monopod.intra.ispras.ru \
--to=amonakov@ispras.ru \
--cc=abel@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).