diff options
author | Richard Biener <rguenther@suse.de> | 2013-04-26 08:01:19 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2013-04-26 08:01:19 +0000 |
commit | a9e0d843713b294d12c3a3faedbc0c817e581014 (patch) | |
tree | 6dc72b0a543f5b83d0d65dbb0cb065eb0cb323b5 /gcc/tree-inline.c | |
parent | a2e836b2ac02b691a2085888d3a73d0296e93970 (diff) | |
download | gcc-a9e0d843713b294d12c3a3faedbc0c817e581014.zip gcc-a9e0d843713b294d12c3a3faedbc0c817e581014.tar.gz gcc-a9e0d843713b294d12c3a3faedbc0c817e581014.tar.bz2 |
tree-cfg.c (execute_build_cfg): Build the loop tree.
2013-03-26 Richard Biener <rguenther@suse.de>
* tree-cfg.c (execute_build_cfg): Build the loop tree.
(pass_build_cfg): Provide PROP_loops.
(move_sese_region_to_fn): Remove loops that are outlined into fn
for now.
* tree-inline.c: Include cfgloop.h.
(initialize_cfun): Do not drop PROP_loops.
(copy_loops): New function.
(copy_cfg_body): Copy loop structure.
(tree_function_versioning): Initialize destination loop tree.
* tree-ssa-loop.c (pass_tree_loop_init): Do not provide PROP_loops.
(pass_parallelize_loops): Do IL verification.
* loop-init.c (loop_optimizer_init): Fixup loops if required.
* tree-optimize.c (execute_fixup_cfg): If we need to cleanup
the CFG make sure we fixup loops as well.
* tree-ssa-tail-merge.c: Include cfgloop.h.
(replace_block_by): When merging loop latches mark loops for fixup.
* lto-streamer-out.c (output_struct_function_base): Drop
PROP_loops for now.
* tree-ssa-phiopt.c: Include tree-scalar-evolution.h.
(tree_ssa_cs_elim): Initialize the loop optimizer and SCEV.
* ipa-split.c: Include cfgloop.h.
(split_function): Add the new return block to the loop tree root.
* tree-cfgcleanup.c (remove_forwarder_block_with_phi): Return
whether we have removed the forwarder block.
(merge_phi_nodes): If we removed a forwarder mark loops for fixup.
* cfgloop.h (place_new_loop): Declare.
* cfgloopmanip.c (place_new_loop): Export.
* Makefile.in (asan.o): Add $(CFGLOOP_H) dependency.
(tree-switch-conversion.o): Likewise.
(tree-complex.o): Likewise.
(tree-inline.o): Likewise.
(tree-ssa-tailmerge.o): Likewise.
(ipa-split.o): Likewise.
(tree-ssa-phiopt.o): Add $(SCEV_H) dependency.
(tree-ssa-copy.o): Likewise.
* tree-switch-conversion.c: Include cfgloop.h
(process_switch): If we emit a bit-test cascade, schedule loops
for fixup.
* tree-complex.c: Include cfgloop.h.
(expand_complex_div_wide): Properly add new basic-blocks to loops.
* asan.c: Include cfgloop.h.
(create_cond_insert_point): Properly add new basic-blocks to
loops, schedule loop fixup.
* cfgloop.c (verify_loop_structure): Check that looks are not
marked for fixup.
* omp-low.c (expand_parallel_call): Properly add new basic-blocks
to loops.
(expand_omp_for_generic): Likewise.
(expand_omp_sections): Likewise.
(expand_omp_atomic_pipeline): Schedule loops for fixup.
* tree-ssa-copy.c: Include tree-scalar-evolution.h.
(fini_copy_prop): Disable DCE in substitute_and_fold if SCEV
is initialized, not when loops are present.
* tree-parloops.c (parallelize_loops): Remove checking here.
* passes.c (init_optimization_passes): Schedule a copy-propagation
pass before complete unrolling of inner loops.
* gcc.dg/tree-prof/update-loopch.c: Revert last change.
* gcc.dg/graphite/pr33766.c: Fix undefined behavior.
* gcc.dg/pr53265.c: Remove XFAILs.
* gcc.dg/tree-ssa/loop-38.c: Remove unreliable dump scanning.
* gcc.dg/tree-ssa/pr21559.c: Change back to two expected jump threads.
From-SVN: r198333
Diffstat (limited to 'gcc/tree-inline.c')
-rw-r--r-- | gcc/tree-inline.c | 61 |
1 files changed, 60 insertions, 1 deletions
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index 7fa0245..c358cbe 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -47,6 +47,7 @@ along with GCC; see the file COPYING3. If not see #include "value-prof.h" #include "tree-pass.h" #include "target.h" +#include "cfgloop.h" #include "rtl.h" /* FIXME: For asm_str_count. */ @@ -2088,7 +2089,7 @@ initialize_cfun (tree new_fndecl, tree callee_fndecl, gcov_type count) cfun->static_chain_decl = src_cfun->static_chain_decl; cfun->nonlocal_goto_save_area = src_cfun->nonlocal_goto_save_area; cfun->function_end_locus = src_cfun->function_end_locus; - cfun->curr_properties = src_cfun->curr_properties & ~PROP_loops; + cfun->curr_properties = src_cfun->curr_properties; cfun->last_verified = src_cfun->last_verified; cfun->va_list_gpr_size = src_cfun->va_list_gpr_size; cfun->va_list_fpr_size = src_cfun->va_list_fpr_size; @@ -2193,6 +2194,45 @@ maybe_move_debug_stmts_to_successors (copy_body_data *id, basic_block new_bb) } } +/* Make a copy of the sub-loops of SRC_PARENT and place them + as siblings of DEST_PARENT. */ + +static void +copy_loops (bitmap blocks_to_copy, + struct loop *dest_parent, struct loop *src_parent) +{ + struct loop *src_loop = src_parent->inner; + while (src_loop) + { + if (!blocks_to_copy + || bitmap_bit_p (blocks_to_copy, src_loop->header->index)) + { + struct loop *dest_loop = alloc_loop (); + + /* Assign the new loop its header and latch and associate + those with the new 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; + dest_loop->latch->loop_father = dest_loop; + } + + /* Copy loop meta-data. */ + copy_loop_info (src_loop, dest_loop); + + /* Finally place it into the loop array and the loop tree. */ + place_new_loop (dest_loop); + flow_loop_tree_node_add (dest_parent, dest_loop); + + /* Recurse. */ + copy_loops (blocks_to_copy, dest_loop, src_loop); + } + src_loop = src_loop->next; + } +} + /* Make a copy of the body of FN so that it can be inserted inline in another function. Walks FN via CFG, returns new fndecl. */ @@ -2270,6 +2310,7 @@ copy_cfg_body (copy_body_data * id, gcov_type count, int frequency_scale, basic_block new_bb = copy_bb (id, bb, frequency_scale, count_scale); bb->aux = new_bb; new_bb->aux = bb; + new_bb->loop_father = entry_block_map->loop_father; } last = last_basic_block; @@ -2290,6 +2331,16 @@ copy_cfg_body (copy_body_data * id, gcov_type count, int frequency_scale, e->count = incoming_count; } + /* Duplicate the loop tree, if available and wanted. */ + if (id->src_cfun->x_current_loops != NULL + && current_loops != NULL) + { + copy_loops (blocks_to_copy, entry_block_map->loop_father, + id->src_cfun->x_current_loops->tree_root); + /* Defer to cfgcleanup to update loop-father fields of basic-blocks. */ + loops_state_set (LOOPS_NEED_FIXUP); + } + if (gimple_in_ssa_p (cfun)) FOR_ALL_BB_FN (bb, cfun_to_copy) if (!blocks_to_copy @@ -5147,6 +5198,14 @@ tree_function_versioning (tree old_decl, tree new_decl, } } + /* Set up the destination functions loop tree. */ + if (DECL_STRUCT_FUNCTION (old_decl)->x_current_loops) + { + cfun->curr_properties &= ~PROP_loops; + loop_optimizer_init (AVOID_CFG_MODIFICATIONS); + cfun->curr_properties |= PROP_loops; + } + /* Copy the Function's body. */ copy_body (&id, old_entry_block->count, REG_BR_PROB_BASE, ENTRY_BLOCK_PTR, EXIT_BLOCK_PTR, blocks_to_copy, new_entry); |