aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-cfg.c
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2006-07-24 13:27:53 +0200
committerJan Hubicka <hubicka@gcc.gnu.org>2006-07-24 11:27:53 +0000
commit597ae07482f698e4d1f03861ef775fb6703627f9 (patch)
treed178fe07a5109b0f0e76af5303139624cf4bdd77 /gcc/tree-cfg.c
parentf10d1a747d57ce28acd2b83ce96c154af5e9a286 (diff)
downloadgcc-597ae07482f698e4d1f03861ef775fb6703627f9.zip
gcc-597ae07482f698e4d1f03861ef775fb6703627f9.tar.gz
gcc-597ae07482f698e4d1f03861ef775fb6703627f9.tar.bz2
re PR middle-end/28071 (A file that can not be compiled in reasonable time/space)
PR rtl-optimization/28071 * tree-cfg.c (tree_split_block): Do not allocate new stmt_list nodes. * tree-iterator.c (tsi_split_statement_list_before): Do not crash when splitting before first stmt. From-SVN: r115713
Diffstat (limited to 'gcc/tree-cfg.c')
-rw-r--r--gcc/tree-cfg.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index 82adabd..ced7807 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -4158,7 +4158,8 @@ tree_redirect_edge_and_branch_force (edge e, basic_block dest)
static basic_block
tree_split_block (basic_block bb, void *stmt)
{
- block_stmt_iterator bsi, bsi_tgt;
+ block_stmt_iterator bsi;
+ tree_stmt_iterator tsi_tgt;
tree act;
basic_block new_bb;
edge e;
@@ -4192,13 +4193,17 @@ tree_split_block (basic_block bb, void *stmt)
}
}
- bsi_tgt = bsi_start (new_bb);
- while (!bsi_end_p (bsi))
- {
- act = bsi_stmt (bsi);
- bsi_remove (&bsi, false);
- bsi_insert_after (&bsi_tgt, act, BSI_NEW_STMT);
- }
+ if (bsi_end_p (bsi))
+ return new_bb;
+
+ /* Split the statement list - avoid re-creating new containers as this
+ brings ugly quadratic memory consumption in the inliner.
+ (We are still quadratic since we need to update stmt BB pointers,
+ sadly.) */
+ 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);
return new_bb;
}