Hi, also this code ignores counts and probabilities: /* Rewire the entry and exit blocks. The successor to the entry block turns into the successor of DEST_FN's ENTRY_BLOCK_PTR in the child function. Similarly, the predecessor of DEST_FN's EXIT_BLOCK_PTR turns into the predecessor of EXIT_BLOCK_PTR. We need to switch CFUN between DEST_CFUN and SAVED_CFUN so that the various CFG manipulation function get to the right CFG.
FIXME, this is silly. The CFG ought to become a parameter to these helpers. */ push_cfun (dest_cfun); make_edge (ENTRY_BLOCK_PTR_FOR_FN (cfun), entry_bb, EDGE_FALLTHRU); if (exit_bb) make_edge (exit_bb, EXIT_BLOCK_PTR_FOR_FN (cfun), 0); pop_cfun (); /* Back in the original function, the SESE region has disappeared, create a new basic block in its place. */ bb = create_empty_bb (entry_pred[0]); if (current_loops) add_bb_to_loop (bb, loop); for (i = 0; i < num_entry_edges; i++) { e = make_edge (entry_pred[i], bb, entry_flag[i]); e->probability = entry_prob[i]; } for (i = 0; i < num_exit_edges; i++) { e = make_edge (bb, exit_succ[i], exit_flag[i]); e->probability = exit_prob[i]; } Finally I am somewhat concerned about move_block_to_fn. The frequencies in one function may have different base from other function, so they may need rescaling. Honza