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  <i...@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  <i...@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

Reply via email to