This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] Cleanup the CFG after pro_and_epilogue pass (PR rtl-optimization/57320)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Jeff Law <law at redhat dot com>
- Cc: Steven Bosscher <stevenb dot gcc at gmail dot com>, Bernd Schmidt <bernds at codesourcery dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 13 Mar 2014 19:03:11 +0100
- Subject: Re: [patch] Cleanup the CFG after pro_and_epilogue pass (PR rtl-optimization/57320)
- Authentication-results: sourceware.org; auth=none
- References: <CABu31nOj1yqt3nwWYqDHBBtZiJQ3GM9brnBjcmA3+paucXXKtw at mail dot gmail dot com> <51968A87 dot 7000008 at redhat dot com> <CABu31nPrdc0H5M+PrU+Zz2VX906qNHLf8gm33uX7yvWdVS2w-Q at mail dot gmail dot com> <51969E20 dot 6010505 at redhat dot com> <CABu31nP95rb0D__5bo5ryZF_iTHUeXgzUmPAVBMTYJ7ffP4x4g at mail dot gmail dot com> <5196A82B dot 5090203 at redhat dot com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Fri, May 17, 2013 at 03:59:07PM -0600, Jeff Law wrote:
> On 05/17/2013 03:53 PM, Steven Bosscher wrote:
> >On Fri, May 17, 2013 at 11:16 PM, Jeff Law wrote:
> >>>What's happened, is that emitting the epilogue at the end of basic
> >>>block 4 (with a barrier at the end) has made the use insn 43
> >>>unreachable.
> >>
> >>But from the description you've given, it appears that the epilogue itself
> >>has unreachable code, and that shouldn't be happening. If you think it can
> >>happen by way of shrink-wrapping, I'd like to see the analysis.
> >
> >It is not the epilogue itself but the way shrink-wrapping emits it.
> >The block that is unreachable has its last predecessor edge removed in
> >function.c:6607:
> >
> >6607 redirect_edge_and_branch_force (e, *pdest_bb);
> >
> >I haven't looked at how the shrink-wrapping code works exactly. It's
> >Bernd's code, so perhaps he can have a look. This is now PR57320.
> OK. Let's go with your patch then. Approved with a comment that
> shrink-wrapping can result in unreachable edges in the epilogue.
I have bootstrapped/regtested Steven's patch now and committed to trunk:
2014-03-13 Steven Bosscher <steven@gcc.gnu.org>
PR rtl-optimization/57320
* function.c (rest_of_handle_thread_prologue_and_epilogue): Cleanup
the CFG after thread_prologue_and_epilogue_insns.
--- gcc/function.c.jj 2014-03-03 08:25:17.000000000 +0100
+++ gcc/function.c 2014-03-13 15:42:30.534922406 +0100
@@ -6991,6 +6991,10 @@ rest_of_handle_thread_prologue_and_epilo
scheduling to operate in the epilogue. */
thread_prologue_and_epilogue_insns ();
+ /* Shrink-wrapping can result in unreachable edges in the epilogue,
+ see PR57320. */
+ cleanup_cfg (0);
+
/* The stack usage info is finalized during prologue expansion. */
if (flag_stack_usage_info)
output_stack_usage ();
Jakub