Hi! The checking code insists on edges to EXIT_BLOCK_PTR (and from ENTRY_BLOCK_PTR) to have no EDGE_CROSSING bit set, so if we have a bb in second partition jumping to first partition's entry block and convert_jumps_to_returns changes it to simple_return, we need to drop the EDGE_CROSSING bit.
Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2011-11-28 Jakub Jelinek <ja...@redhat.com> PR middle-end/50907 * function.c (convert_jumps_to_returns): When redirecting an edge succ to EXIT_BLOCK_PTR, clear EDGE_CROSSING flag. * gcc.dg/tree-prof/pr50907.c: New test. --- gcc/function.c.jj 2011-11-21 16:22:02.000000000 +0100 +++ gcc/function.c 2011-11-28 11:09:39.581873481 +0100 @@ -5670,6 +5670,7 @@ convert_jumps_to_returns (basic_block la /* Fix up the CFG for the successful change we just made. */ redirect_edge_succ (e, EXIT_BLOCK_PTR); + e->flags &= ~EDGE_CROSSING; } VEC_free (basic_block, heap, src_bbs); return unconverted; --- gcc/testsuite/gcc.dg/tree-prof/pr50907.c.jj 2011-11-28 11:12:12.769979965 +0100 +++ gcc/testsuite/gcc.dg/tree-prof/pr50907.c 2011-11-28 11:13:40.055475777 +0100 @@ -0,0 +1,5 @@ +/* PR middle-end/50907 */ +/* { dg-require-effective-target freorder } */ +/* { dg-options "-O -freorder-blocks-and-partition -fschedule-insns -fselective-scheduling -fpic" { target { { powerpc*-*-* ia64-*-* x86_64-*-* } && fpic } } } */ + +#include "pr45354.c" Jakub