]> git.ipfire.org Git - thirdparty/gcc.git/commit
Move jump threading before reload
authorIlya Leoshkevich <iii@linux.ibm.com>
Mon, 28 Oct 2019 13:09:54 +0000 (13:09 +0000)
committerIlya Leoshkevich <iii@gcc.gnu.org>
Mon, 28 Oct 2019 13:09:54 +0000 (13:09 +0000)
commit5a71e1eb81c6bcff535f316b315cd59e8aed7b41
treea0d5c4554dae23bd50906c46a0b36102c6383b00
parent53663374619753dd84055edd74ba00cb76d5635e
Move jump threading before reload

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-28  Ilya Leoshkevich  <iii@linux.ibm.com>

Backport from mainline
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-28  Ilya Leoshkevich  <iii@linux.ibm.com>

Backport from mainline
PR rtl-optimization/92007
* g++.dg/opt/pr92007.C: New test (from Arseny Solokha).

From-SVN: r277515
gcc/ChangeLog
gcc/cfgcleanup.c
gcc/passes.def
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/opt/pr92007.C [new file with mode: 0644]
gcc/tree-pass.h