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-cfgcleanup.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-cfgcleanup.c')
-rw-r--r-- | gcc/tree-cfgcleanup.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/gcc/tree-cfgcleanup.c b/gcc/tree-cfgcleanup.c index b355a86..3c69a7d 100644 --- a/gcc/tree-cfgcleanup.c +++ b/gcc/tree-cfgcleanup.c @@ -748,9 +748,10 @@ cleanup_tree_cfg (void) return changed; } -/* Merge the PHI nodes at BB into those at BB's sole successor. */ +/* Tries to merge the PHI nodes at BB into those at BB's sole successor. + Returns true if successful. */ -static void +static bool remove_forwarder_block_with_phi (basic_block bb) { edge succ = single_succ_edge (bb); @@ -762,7 +763,7 @@ remove_forwarder_block_with_phi (basic_block bb) However it may happen that the infinite loop is created afterwards due to removal of forwarders. */ if (dest == bb) - return; + return false; /* If the destination block consists of a nonlocal label, do not merge it. */ @@ -770,7 +771,7 @@ remove_forwarder_block_with_phi (basic_block bb) if (label && gimple_code (label) == GIMPLE_LABEL && DECL_NONLOCAL (gimple_label_label (label))) - return; + return false; /* Redirect each incoming edge to BB to DEST. */ while (EDGE_COUNT (bb->preds) > 0) @@ -859,6 +860,8 @@ remove_forwarder_block_with_phi (basic_block bb) /* Remove BB since all of BB's incoming edges have been redirected to DEST. */ delete_basic_block (bb); + + return true; } /* This pass merges PHI nodes if one feeds into another. For example, @@ -960,13 +963,20 @@ merge_phi_nodes (void) } /* Now let's drain WORKLIST. */ + bool changed = false; while (current != worklist) { bb = *--current; - remove_forwarder_block_with_phi (bb); + changed |= remove_forwarder_block_with_phi (bb); } - free (worklist); + + /* Removing forwarder blocks can cause formerly irreducible loops + to become reducible if we merged two entry blocks. */ + if (changed + && current_loops) + loops_state_set (LOOPS_NEED_FIXUP); + return 0; } |