diff mbox

Cleanup the CFG after pro_and_epilogue pass (PR rtl-optimization/57320)

Message ID 20140313180311.GA22862@tucnak.redhat.com
State New
Headers show

Commit Message

Jakub Jelinek March 13, 2014, 6:03 p.m. UTC
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.



	Jakub
diff mbox

Patch

--- 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 ();