aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-cfg.c
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2006-08-02 11:34:34 +0200
committerJan Hubicka <hubicka@gcc.gnu.org>2006-08-02 09:34:34 +0000
commit0a4fe58f40b2ec68762d965ec148100e353ee562 (patch)
treecda3cd19800c29aae1a5538d400479190839eb9b /gcc/tree-cfg.c
parent1ec481b18c4a6008afbfd4fca00655c9fb4d0c0d (diff)
downloadgcc-0a4fe58f40b2ec68762d965ec148100e353ee562.zip
gcc-0a4fe58f40b2ec68762d965ec148100e353ee562.tar.gz
gcc-0a4fe58f40b2ec68762d965ec148100e353ee562.tar.bz2
PR gcov/profile/28480
PR gcov/profile/28480 * tree-cfg.c (change_bb_for_stmt): New function. (tree_merge_blocks, tree_split_blocks): Use it. From-SVN: r115873
Diffstat (limited to 'gcc/tree-cfg.c')
-rw-r--r--gcc/tree-cfg.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index ced7807..02bc008 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -112,6 +112,7 @@ static inline bool stmt_starts_bb_p (tree, tree);
static int tree_verify_flow_info (void);
static void tree_make_forwarder_block (edge);
static void tree_cfg2vcg (FILE *);
+static inline void change_bb_for_stmt (tree t, basic_block bb);
/* Flowgraph optimization and cleanup. */
static void tree_merge_blocks (basic_block, basic_block);
@@ -1386,7 +1387,7 @@ tree_merge_blocks (basic_block a, basic_block b)
}
else
{
- set_bb_for_stmt (bsi_stmt (bsi), a);
+ change_bb_for_stmt (bsi_stmt (bsi), a);
bsi_next (&bsi);
}
}
@@ -2778,6 +2779,20 @@ set_bb_for_stmt (tree t, basic_block bb)
}
}
+/* Faster version of set_bb_for_stmt that assume that statement is being moved
+ from one basic block to another.
+ For BB splitting we can run into quadratic case, so performance is quite
+ important and knowing that the tables are big enought, change_bb_for_stmt
+ can inline as leaf function. */
+static inline void
+change_bb_for_stmt (tree t, basic_block bb)
+{
+ get_stmt_ann (t)->bb = bb;
+ if (TREE_CODE (t) == LABEL_EXPR)
+ VEC_replace (basic_block, label_to_block_map,
+ LABEL_DECL_UID (LABEL_EXPR_LABEL (t)), bb);
+}
+
/* Finds iterator for STMT. */
extern block_stmt_iterator
@@ -4203,7 +4218,7 @@ tree_split_block (basic_block bb, void *stmt)
new_bb->stmt_list = tsi_split_statement_list_before (&bsi.tsi);
for (tsi_tgt = tsi_start (new_bb->stmt_list);
!tsi_end_p (tsi_tgt); tsi_next (&tsi_tgt))
- set_bb_for_stmt (tsi_stmt (tsi_tgt), new_bb);
+ change_bb_for_stmt (tsi_stmt (tsi_tgt), new_bb);
return new_bb;
}