diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9f4ac8b9260..6137b1a4b67 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2014-09-08 Richard Biener + + PR ipa/63196 + * tree-inline.c (copy_loops): The source loop header should + always be non-NULL. + (tree_function_versioning): If loops need fixup after removing + unreachable blocks fix them. + * omp-low.c (simd_clone_adjust): Do not add incr block to + loop under construction. + 2014-09-08 Alan Lawrence * config/aarch64/aarch64-builtins.c diff --git a/gcc/omp-low.c b/gcc/omp-low.c index 22a8fcab57f..be882f72628 100644 --- a/gcc/omp-low.c +++ b/gcc/omp-low.c @@ -11900,6 +11900,7 @@ simd_clone_adjust (struct cgraph_node *node) iteration increment and the condition/branch. */ basic_block orig_exit = EDGE_PRED (EXIT_BLOCK_PTR_FOR_FN (cfun), 0)->src; basic_block incr_bb = create_empty_bb (orig_exit); + add_bb_to_loop (incr_bb, body_bb->loop_father); /* The succ of orig_exit was EXIT_BLOCK_PTR_FOR_FN (cfun), with an empty flag. Set it now to be a FALLTHRU_EDGE. */ gcc_assert (EDGE_COUNT (orig_exit->succs) == 1); @@ -11924,7 +11925,6 @@ simd_clone_adjust (struct cgraph_node *node) loop->safelen = node->simdclone->simdlen; loop->force_vectorize = true; loop->header = body_bb; - add_bb_to_loop (incr_bb, loop); /* Branch around the body if the mask applies. */ if (node->simdclone->inbranch) @@ -11965,7 +11965,7 @@ simd_clone_adjust (struct cgraph_node *node) gsi_insert_after (&gsi, g, GSI_CONTINUE_LINKING); e = split_block (incr_bb, gsi_stmt (gsi)); basic_block latch_bb = e->dest; - basic_block new_exit_bb = e->dest; + basic_block new_exit_bb; new_exit_bb = split_block (latch_bb, NULL)->dest; loop->latch = latch_bb; diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index b82a1471f45..ad474a58604 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -2376,11 +2376,8 @@ copy_loops (copy_body_data *id, /* Assign the new loop its header and latch and associate those with the new loop. */ - if (src_loop->header != NULL) - { - dest_loop->header = (basic_block)src_loop->header->aux; - dest_loop->header->loop_father = dest_loop; - } + dest_loop->header = (basic_block)src_loop->header->aux; + dest_loop->header->loop_father = dest_loop; if (src_loop->latch != NULL) { dest_loop->latch = (basic_block)src_loop->latch->aux; @@ -5536,6 +5533,11 @@ tree_function_versioning (tree old_decl, tree new_decl, delete_unreachable_blocks_update_callgraph (&id); if (id.dst_node->definition) cgraph_edge::rebuild_references (); + if (loops_state_satisfies_p (LOOPS_NEED_FIXUP)) + { + calculate_dominance_info (CDI_DOMINATORS); + fix_loop_structure (NULL); + } update_ssa (TODO_update_ssa); /* After partial cloning we need to rescale frequencies, so they are