From: Jan Hubicka Date: Thu, 11 Sep 2008 12:34:53 +0000 (+0200) Subject: re PR middle-end/37448 (cannot compile big function) X-Git-Tag: releases/gcc-4.4.0~2490 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4a283090455f0d8c9271d18d2e02e1c1c6717809;p=thirdparty%2Fgcc.git re PR middle-end/37448 (cannot compile big function) PR middle-end/37448 * tree-inline.c (add_lexical_block): Replace with ... (prepend_lexical_block): ... prepend at begginig. (remap_blocks): Use it and reverse later. (expand_call_inline): Use prepend_lexical_block. From-SVN: r140281 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f794028fe2c6..5777b0cbb9a4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2008-09-11 Jan Hubicka + + PR middle-end/37448 + * tree-inline.c (add_lexical_block): Replace with ... + (prepend_lexical_block): ... prepend at begginig. + (remap_blocks): Use it and reverse later. + (expand_call_inline): Use prepend_lexical_block. + 2008-09-11 Jan Hubicka * gimplify.c (pop_gimplify_context): Free bind_expr_stack. diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index c38c322cbc3a..114cd4718e35 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -129,7 +129,7 @@ static void unsave_expr_1 (tree); static tree unsave_r (tree *, int *, void *); static void declare_inline_vars (tree, tree); static void remap_save_expr (tree *, void *, int *); -static void add_lexical_block (tree current_block, tree new_block); +static void prepend_lexical_block (tree current_block, tree new_block); static tree copy_decl_to_var (tree, copy_body_data *); static tree copy_result_decl_to_var (tree, copy_body_data *); static tree copy_decl_maybe_to_var (tree, copy_body_data *); @@ -512,7 +512,10 @@ remap_blocks (tree block, copy_body_data *id) remap_block (&new_tree, id); gcc_assert (new_tree != block); for (t = BLOCK_SUBBLOCKS (block); t ; t = BLOCK_CHAIN (t)) - add_lexical_block (new_tree, remap_blocks (t, id)); + prepend_lexical_block (new_tree, remap_blocks (t, id)); + /* Blocks are in arbitrary order, but make things slightly prettier and do + not swap order when producing a copy. */ + BLOCK_SUBBLOCKS (new_tree) = blocks_nreverse (BLOCK_SUBBLOCKS (new_tree)); return new_tree; } @@ -3032,16 +3035,10 @@ count_insns_seq (gimple_seq seq, eni_weights *weights) /* Install new lexical TREE_BLOCK underneath 'current_block'. */ static void -add_lexical_block (tree current_block, tree new_block) +prepend_lexical_block (tree current_block, tree new_block) { - tree *blk_p; - - /* Walk to the last sub-block. */ - for (blk_p = &BLOCK_SUBBLOCKS (current_block); - *blk_p; - blk_p = &BLOCK_CHAIN (*blk_p)) - ; - *blk_p = new_block; + BLOCK_CHAIN (new_block) = BLOCK_SUBBLOCKS (current_block); + BLOCK_SUBBLOCKS (current_block) = new_block; BLOCK_SUPERCONTEXT (new_block) = current_block; } @@ -3222,7 +3219,7 @@ expand_call_inline (basic_block bb, gimple stmt, copy_body_data *id) id->block = make_node (BLOCK); BLOCK_ABSTRACT_ORIGIN (id->block) = fn; BLOCK_SOURCE_LOCATION (id->block) = input_location; - add_lexical_block (gimple_block (stmt), id->block); + prepend_lexical_block (gimple_block (stmt), id->block); /* Local declarations will be replaced by their equivalents in this map. */ @@ -3248,7 +3245,7 @@ expand_call_inline (basic_block bb, gimple stmt, copy_body_data *id) initialize_inlined_parameters (id, stmt, fn, bb); if (DECL_INITIAL (fn)) - add_lexical_block (id->block, remap_blocks (DECL_INITIAL (fn), id)); + prepend_lexical_block (id->block, remap_blocks (DECL_INITIAL (fn), id)); /* Return statements in the function body will be replaced by jumps to the RET_LABEL. */