This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Fix PR 53743 and other -freorder-blocks-and-partition failures (issue6823047)
- From: Steven Bosscher <stevenb dot gcc at gmail dot com>
- To: Teresa Johnson <tejohnson at google dot com>
- Cc: Xinliang David Li <davidxl at google dot com>, Diego Novillo <dnovillo at google dot com>, "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, Jan Hubicka <hubicka at ucw dot cz>
- Date: Sat, 11 May 2013 17:02:31 +0200
- Subject: Re: Fix PR 53743 and other -freorder-blocks-and-partition failures (issue6823047)
- References: <20130508050850 dot 923A7809EE at tjsboxrox dot mtv dot corp dot google dot com> <CAAe5K+UW5MfcbaHCp+zWTGM9fZvKm6x6no9WDrOOKsap0vvxUQ at mail dot gmail dot com> <518C1851 dot 7030903 at google dot com> <CABu31nNmHHvnatfVcRucsnv8yhQ_Ud-SkunECcc7pLq+L20_gg at mail dot gmail dot com> <CAAkRFZ+ezFmGhxpOg1Md=rFV1=+jUu83ut_O1mHvz2rrcTDSOQ at mail dot gmail dot com> <CABu31nMPLetTv=vaXChvZit4o8sUsB_N8ppV8aKn_Ym9bL2dNA at mail dot gmail dot com> <CAAe5K+W=vUgyRm9_0bdJQKjUunQKMuWaCEPikowUHm35XWhHPw at mail dot gmail dot com> <CABu31nO9YR83bkBh1h+Kqh7PgDUFG9hP4ev68C++0SwL3NdsfQ at mail dot gmail dot com> <CAAe5K+WP=FQj4Hn3oLvXbry-bF44ABu9uH_t_ZCdtHvywYP2Cw at mail dot gmail dot com> <CABu31nNEKQ5pKObX4iKpRta63ONJQnFitoZbA3Ch5Z1afrisbw at mail dot gmail dot com> <CAAe5K+V5WOR4TQRJJoigJ7z53__3HcFWA34qjvGHmTJCaX8Pow at mail dot gmail dot com>
On Sat, May 11, 2013 at 4:38 PM, Teresa Johnson <tejohnson@google.com> wrote:
> /* If we are partitioning hot/cold basic blocks, we don't want to
> mess up unconditional or indirect jumps that cross between hot
> and cold sections.
>
> Basic block partitioning may result in some jumps that appear to
> be optimizable (or blocks that appear to be mergeable), but which really
> must be left untouched (they are required to make it safely across
> partition boundaries). See the comments at the top of
> bb-reorder.c:partition_hot_cold_basic_blocks for complete details. */
>
> And at least a bunch of these are when we are in cfglayout mode.
>
> But let me locate a reproducer so we can make sure it isn't due to
> some issue with my patch.
It sounds like the issue here is that the partitioning code insists on
having an explicit jump for a section switch even for single_succ_p
blocks i.e. unconditional jump, while normally in cfglayout mode there
are no unconditional jumps.
If that is the problem, then the proper solution is to not have the
explicit jump. Just forward the jump, set the EDGE_CROSSING flag on
the crossing edge, and add a REG_CROSSING_JUMP note on the branching
insn. (FWIW, these REG_CROSSING_JUMP notes are also an aberration --
we have the CFG edges with all the information in them! But oh
well...) If the edge cannot fall through when going out of cfglayout
mode after bbro (and crossing edges can't fall through) then an extra
"forwarder jump" block will be inserted automatically. This may
require some hacking to invert branch conditions for branching insns
such that the branch goes to the other section and that the fallthru
path stays in the same section, but that's something that should be
relatively easy to do in cfgcleanup.
Ciao!
Steven