Index: tree-cfg.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/tree-cfg.c,v retrieving revision 2.136 diff -u -p -r2.136 tree-cfg.c --- tree-cfg.c 13 Dec 2004 16:06:23 -0000 2.136 +++ tree-cfg.c 17 Dec 2004 04:40:42 -0000 @@ -1238,8 +1238,12 @@ tree_can_merge_blocks_p (basic_block a, phi nodes should be cleaned up by kill_redundant_phi_nodes. */ if (phi_nodes (b)) return false; + + /* If we are optimizing we can merge the basic blocks. */ + if (optimize) + return true; - /* Do not remove user labels. */ + /* Do not move user labels if we are not optimizing. */ for (bsi = bsi_start (b); !bsi_end_p (bsi); bsi_next (&bsi)) { stmt = bsi_stmt (bsi); @@ -1270,14 +1274,26 @@ tree_merge_blocks (basic_block a, basic_ gcc_assert (EDGE_SUCC (a, 0)->flags & EDGE_FALLTHRU); gcc_assert (!last_stmt (a) || !stmt_ends_bb_p (last_stmt (a))); - /* Remove labels from B and set bb_for_stmt to A for other statements. */ + /* Move the user labels from A to B and remove other labels from B + and set bb_for_stmt to A for other statements. */ for (bsi = bsi_start (b); !bsi_end_p (bsi);) { - if (TREE_CODE (bsi_stmt (bsi)) == LABEL_EXPR) - bsi_remove (&bsi); + tree stmt = bsi_stmt (bsi); + if (TREE_CODE (stmt) == LABEL_EXPR) + { + if (!DECL_ARTIFICIAL (LABEL_EXPR_LABEL (stmt))) + { + block_stmt_iterator new_bsi = bsi_start (a); + + bsi_remove (&bsi); + bsi_insert_before (&new_bsi, stmt, BSI_NEW_STMT); + } + else + bsi_remove (&bsi); + } else { - set_bb_for_stmt (bsi_stmt (bsi), a); + set_bb_for_stmt (stmt, a); bsi_next (&bsi); } }