X-Git-Url: http://git.sourceforge.jp/view?a=blobdiff_plain;f=gcc%2Fdomwalk.c;h=2713e04c097fe955f5635a959085b45d1c772b38;hb=0ff99c7907cd58c9799d0d45dbf5025b21c5465e;hp=ce0ccd113e48b63498fd6cbb7e08e96ffad7cf5a;hpb=4ee9c6840ad3fc92a9034343278a1e476ad6872a;p=pf3gnuchains%2Fgcc-fork.git diff --git a/gcc/domwalk.c b/gcc/domwalk.c index ce0ccd113e4..2713e04c097 100644 --- a/gcc/domwalk.c +++ b/gcc/domwalk.c @@ -1,5 +1,5 @@ /* Generic dominator tree walker - Copyright (C) 2003, 2004 Free Software Foundation, Inc. + Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc. Contributed by Diego Novillo This file is part of GCC. @@ -52,7 +52,7 @@ Boston, MA 02111-1307, USA. */ [ Note this walker can also walk the post-dominator tree, which is - defined in a similar manner. ie, block B1 is said to post-dominate + defined in a similar manner. i.e., block B1 is said to post-dominate block B2 if all paths from B2 to the exit block must pass through B1. ] @@ -145,6 +145,14 @@ walk_dominator_tree (struct dom_walk_data *walk_data, basic_block bb) void *bd = NULL; basic_block dest; block_stmt_iterator bsi; + bool is_interesting; + + /* If block BB is not interesting to the caller, then none of the + callbacks that walk the statements in BB are going to be + executed. */ + is_interesting = bb->index < 0 + || walk_data->interesting_blocks == NULL + || TEST_BIT (walk_data->interesting_blocks, bb->index); /* Callback to initialize the local data structure. */ if (walk_data->initialize_block_local_data) @@ -179,7 +187,7 @@ walk_dominator_tree (struct dom_walk_data *walk_data, basic_block bb) (*walk_data->before_dom_children_before_stmts) (walk_data, bb); /* Statement walk before walking dominator children. */ - if (walk_data->before_dom_children_walk_stmts) + if (is_interesting && walk_data->before_dom_children_walk_stmts) { if (walk_data->walk_stmts_backward) for (bsi = bsi_last (bb); !bsi_end_p (bsi); bsi_prev (&bsi)) @@ -201,7 +209,7 @@ walk_dominator_tree (struct dom_walk_data *walk_data, basic_block bb) { /* The destination block may have become unreachable, in which case there's no point in optimizing it. */ - if (dest->pred) + if (EDGE_COUNT (dest->preds) > 0) walk_dominator_tree (walk_data, dest); } @@ -211,7 +219,7 @@ walk_dominator_tree (struct dom_walk_data *walk_data, basic_block bb) (*walk_data->after_dom_children_before_stmts) (walk_data, bb); /* Statement walk after walking dominator children. */ - if (walk_data->after_dom_children_walk_stmts) + if (is_interesting && walk_data->after_dom_children_walk_stmts) { if (walk_data->walk_stmts_backward) for (bsi = bsi_last (bb); !bsi_end_p (bsi); bsi_prev (&bsi))