public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jeff Law <law@redhat.com>
To: Ilya Leoshkevich <iii@linux.ibm.com>,
	gcc-patches@gcc.gnu.org, segher@gcc.gnu.org, jakub@redhat.com
Cc: krebbel@linux.ibm.com
Subject: Re: [PATCH] Move jump threading before reload
Date: Sun, 27 Oct 2019 15:32:00 -0000	[thread overview]
Message-ID: <d6521598-f589-30f4-1a97-b8aae8657f6f@redhat.com> (raw)
In-Reply-To: <20191018090645.22404-1-iii@linux.ibm.com>

On 10/18/19 3:06 AM, Ilya Leoshkevich wrote:
> Bootstrapped and regtested on x86_64-redhat-linux, s390x-redhat-linux
> and ppc64le-redhat-linux.  The offending patch is in gcc-9_1_0-release
> and gcc-9_2_0-release - do I need to backport this fix to gcc-9-branch?
> 
> 
> r266734 has introduced a new instance of jump threading pass in order to
> take advantage of opportunities that combine opens up.  It was perceived
> back then that it was beneficial to delay it after reload, since that
> might produce even more such opportunities.
> 
> Unfortunately jump threading interferes with hot/cold partitioning.  In
> the code from PR92007, it converts the following
> 
>   +-------------------------- 2/HOT ------------------------+
>   |                                                         |
>   v                                                         v
> 3/HOT --> 5/HOT --> 8/HOT --> 11/COLD --> 6/HOT --EH--> 16/HOT
>             |                               ^
>             |                               |
>             +-------------------------------+
> 
> into the following:
> 
>   +---------------------- 2/HOT ------------------+
>   |                                               |
>   v                                               v
> 3/HOT --> 8/HOT --> 11/COLD --> 6/COLD --EH--> 16/HOT
> 
> This makes hot bb 6 dominated by cold bb 11, and because of this
> fixup_partitions makes bb 6 cold as well, which in turn makes EH edge
> 6->16 a crossing one.  Not only can't we have crossing EH edges, we are
> also not allowed to introduce new crossing edges after reload in
> general, since it might require extra registers on some targets.
> 
> Therefore, move the jump threading pass between combine and hot/cold
> partitioning.  Building SPEC 2006 and SPEC 2017 with the old and the new
> code indicates that:
> 
> * When doing jump threading right after reload, 3889 edges are threaded.
> * When doing jump threading right after combine, 3918 edges are
>   threaded.
> 
> This means this change will not introduce performance regressions.
> 
> gcc/ChangeLog:
> 
> 2019-10-17  Ilya Leoshkevich  <iii@linux.ibm.com>
> 
> 	PR rtl-optimization/92007
> 	* cfgcleanup.c (thread_jump): Add an assertion that we don't
> 	call it after reload if hot/cold partitioning has been done.
> 	(class pass_postreload_jump): Rename to
> 	pass_jump_after_combine.
> 	(make_pass_postreload_jump): Rename to
> 	make_pass_jump_after_combine.
> 	* passes.def(pass_postreload_jump): Move before reload, rename
> 	to pass_jump_after_combine.
> 	* tree-pass.h (make_pass_postreload_jump): Rename to
> 	make_pass_jump_after_combine.
> 
> gcc/testsuite/ChangeLog:
> 
> 2019-10-17  Ilya Leoshkevich  <iii@linux.ibm.com>
> 
> 	PR rtl-optimization/92007
> 	* g++.dg/opt/pr92007.C: New test (from Arseny Solokha).
OK for trunk and gcc-9 branch.

jeff

      parent reply	other threads:[~2019-10-27 15:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-18  9:27 Ilya Leoshkevich
2019-10-18 10:54 ` Segher Boessenkool
2019-10-27 15:32 ` Jeff Law [this message]

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=d6521598-f589-30f4-1a97-b8aae8657f6f@redhat.com \
    --to=law@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=iii@linux.ibm.com \
    --cc=jakub@redhat.com \
    --cc=krebbel@linux.ibm.com \
    --cc=segher@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).