From b02b9b53ec39cfd36e27424c4c07be5880ec393a Mon Sep 17 00:00:00 2001 From: Zdenek Dvorak Date: Thu, 17 May 2007 10:10:24 +0200 Subject: tree-vrp.c (finalize_jump_threads): Do not care about dominance info. * tree-vrp.c (finalize_jump_threads): Do not care about dominance info. (execute_vrp): Preserve loops through jump threading. * tree-ssa-threadupdate.c (thread_single_edge, dbds_continue_enumeration_p, determine_bb_domination_status, thread_through_loop_header): New functions. (create_edge_and_update_destination_phis, create_edge_and_update_destination_phis): Set loops for the new blocks. (prune_undesirable_thread_requests): Removed. (redirect_edges): Do not pretend that redirect_edge_and_branch can create new blocks. (thread_block): Do not call prune_undesirable_thread_requests. Update loops. (mark_threaded_blocks): Select edges to thread here. (thread_through_all_blocks): Take may_peel_loop_headers argument. Thread edges through loop headers independently. * cfgloopmanip.c (create_preheader, mfb_keep_just): Export. * tree-pass.h (TODO_mark_first_instance): New. (first_pass_instance): Declare. * cfghooks.c (duplicate_block): Put the block to the original loop if copy is not specified. * tree-ssa-dom.c (tree_ssa_dominator_optimize): Preserve loops through jump threading. Pass may_peel_loop_headers to thread_through_all_blocks according to first_pass_instance. * cfgloop.h (create_preheader): Declare. * tree-flow.h (thread_through_all_blocks): Declaration changed. * basic-block.h (mfb_keep_just, mfb_kj_edge): Declare. * passes.c (first_pass_instance): New variable. (next_pass_1): Set TODO_mark_first_instance. (execute_todo): Set first_pass_instance. * gcc.dg/tree-ssa/ssa-dom-thread-2.c: New test. * gcc.dg/vect/vect-102.c, gcc.dg/vect/vect-103.c, gcc.dg/vect/vect-104.c: Use more complex construction to prevent vectorizing. * gcc.dg/tree-ssa/pr21559.c: Update outcome. From-SVN: r124786 --- gcc/tree-ssa-dom.c | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) (limited to 'gcc/tree-ssa-dom.c') diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c index 7a14615..87270fc 100644 --- a/gcc/tree-ssa-dom.c +++ b/gcc/tree-ssa-dom.c @@ -277,25 +277,17 @@ tree_ssa_dominator_optimize (void) calculate_dominance_info (CDI_DOMINATORS); cfg_altered = false; - /* We need to know which edges exit loops so that we can - aggressively thread through loop headers to an exit - edge. */ - loop_optimizer_init (AVOID_CFG_MODIFICATIONS); - if (current_loops) - { - mark_loop_exit_edges (); - loop_optimizer_finalize (); - } - - /* Clean up the CFG so that any forwarder blocks created by loop - canonicalization are removed. */ - cleanup_tree_cfg (); - calculate_dominance_info (CDI_DOMINATORS); + /* We need to know loop structures in order to avoid destroying them + in jump threading. Note that we still can e.g. thread through loop + headers to an exit edge, or through loop header to the loop body, assuming + that we update the loop info. */ + loop_optimizer_init (LOOPS_HAVE_SIMPLE_LATCHES); /* We need accurate information regarding back edges in the CFG - for jump threading. */ + for jump threading; this may include back edes that are not part of + a single loop. */ mark_dfs_back_edges (); - + /* Recursively walk the dominator tree optimizing statements. */ walk_dominator_tree (&walk_data, ENTRY_BLOCK_PTR); @@ -319,7 +311,7 @@ tree_ssa_dominator_optimize (void) free_all_edge_infos (); /* Thread jumps, creating duplicate blocks as needed. */ - cfg_altered |= thread_through_all_blocks (); + cfg_altered |= thread_through_all_blocks (first_pass_instance); if (cfg_altered) free_dominance_info (CDI_DOMINATORS); @@ -353,6 +345,8 @@ tree_ssa_dominator_optimize (void) if (dump_file && (dump_flags & TDF_STATS)) dump_dominator_optimization_stats (dump_file); + loop_optimizer_finalize (); + /* Delete our main hashtable. */ htab_delete (avail_exprs); -- cgit v1.1