From 4a6f9e197c022b9b9efb396b6f13a2c2dbc2234f Mon Sep 17 00:00:00 2001 From: rakdver Date: Tue, 6 Feb 2007 21:49:49 +0000 Subject: * doc/loop.texi: Document possibility not to perform disambiguation of loops with multiple latches. * cfgloopmanip.c (alp_enum_p): Removed. (add_loop): Handle subloops. Use get_loop_body_with_size. (create_preheader): Do not allow ENTRY_BLOCK_PTR to be preheader. * cfghooks.c (redirect_edge_and_branch_force): Set dominator for the new forwarder block. (make_forwarder_block): Only call new_bb_cbk if it is not NULL. Handle the case latch is NULL. * tree-ssa-dom.c (tree_ssa_dominator_optimize): Avoid cfg modifications when marking loop exits. * ifcvt.c (if_convert): Ditto. Mark loop exits even if cfg cannot be modified. * loop-init.c (loop_optimizer_init): Do not modify cfg. Call disambiguate_loops_with_multiple_latches. * tree-cfgcleanup.c (cleanup_tree_cfg_loop): Calculate dominators before fix_loop_structure. * cfgloop.c: Include pointer-set.h and output.h. (canonicalize_loop_headers, HEADER_BLOCK, LATCH_EDGE, update_latch_info, mfb_keep_just, mfb_keep_nonlatch): Removed. (get_loop_latch_edges, find_subloop_latch_edge_by_profile, find_subloop_latch_edge_by_ivs, find_subloop_latch_edge, mfb_redirect_edges_in_set, form_subloop, merge_latch_edges, disambiguate_multiple_latches, get_loop_body_with_size, disambiguate_loops_with_multiple_latches): New functions. (flow_loop_dump): Dump multiple latch edges. (flow_loop_nodes_find): Handle loops with multiple latches. (flow_loops_find): Ditto. Do not call canonicalize_loop_headers. (glb_enum_p): Modified. (get_loop_body): Use get_loop_body_with_size. * cfgloop.h (LOOPS_HAVE_RECORDED_EXITS): New flag. (AVOID_CFG_MODIFICATIONS): New constant. (disambiguate_loops_with_multiple_latches, add_loop, get_loop_body_with_size): Declare. * Makefile.in (cfgloop.o): Add pointer-set.h and output.h. * gcc.dg/tree-ssa/loop-25.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@121670 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cfghooks.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'gcc/cfghooks.c') diff --git a/gcc/cfghooks.c b/gcc/cfghooks.c index d65cce98fa9..1fa3aa76498 100644 --- a/gcc/cfghooks.c +++ b/gcc/cfghooks.c @@ -378,6 +378,10 @@ redirect_edge_and_branch_force (edge e, basic_block dest) rescan_loop_exit (e, false, true); ret = cfg_hooks->redirect_edge_and_branch_force (e, dest); + if (ret != NULL + && dom_info_available_p (CDI_DOMINATORS)) + set_immediate_dominator (CDI_DOMINATORS, ret, src); + if (current_loops != NULL) { if (ret != NULL) @@ -724,7 +728,8 @@ make_forwarder_block (basic_block bb, bool (*redirect_edge_p) (edge), fallthru->count = 0; jump = redirect_edge_and_branch_force (e, bb); - if (jump) + if (jump != NULL + && new_bb_cbk != NULL) new_bb_cbk (jump); } @@ -742,9 +747,12 @@ make_forwarder_block (basic_block bb, bool (*redirect_edge_p) (edge), /* If we do not split a loop header, then both blocks belong to the same loop. In case we split loop header and do not redirect the latch edge to DUMMY, then DUMMY belongs to the outer loop, and - BB becomes the new header. */ + BB becomes the new header. If latch is not recorded for the loop, + we leave this updating on the caller (this may only happen during + loop analysis). */ loop = dummy->loop_father; if (loop->header == dummy + && loop->latch != NULL && find_edge (loop->latch, dummy) == NULL) { remove_bb_from_loops (dummy); -- cgit v1.2.3