aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Pinski <pinskia@physics.uc.edu>2004-10-18 19:29:52 +0000
committerAndrew Pinski <pinskia@gcc.gnu.org>2004-10-18 12:29:52 -0700
commit775689606a63636144534eee2d5413cd982e4160 (patch)
tree58381d3964d9ab537f1b3178658796b5077670aa
parentb1c79b464fd417242f70360ebde8d3a551470a97 (diff)
downloadgcc-775689606a63636144534eee2d5413cd982e4160.zip
gcc-775689606a63636144534eee2d5413cd982e4160.tar.gz
gcc-775689606a63636144534eee2d5413cd982e4160.tar.bz2
re PR middle-end/15014 (labels after are removed even though they are used)
2004-10-18 Andrew Pinski <pinskia@physics.uc.edu> PR middle-end/15014 PR middle-end/16973 * tree-cfg.c (remove_bb): If we have a label expression in the basic block and the label we have taken the address, move the label expression to the basic block which is previous in the linked list. (tree_verify_flow_info): Fix printing out the label name of the problematic label expression. From-SVN: r89237
-rw-r--r--gcc/ChangeLog11
-rw-r--r--gcc/tree-cfg.c25
2 files changed, 31 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 074ac3d..089ae2b 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,14 @@
+2004-10-18 Andrew Pinski <pinskia@physics.uc.edu>
+
+ PR middle-end/15014
+ PR middle-end/16973
+ * tree-cfg.c (remove_bb): If we have a label expression in the
+ basic block and the label we have taken the address, move the
+ label expression to the basic block which is previous in the
+ linked list.
+ (tree_verify_flow_info): Fix printing out the label name of the
+ problematic label expression.
+
2004-10-18 Pat Haugen <pthaugen@us.ibm.com>
PR rtl-optimization/18002
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index 72cbbd8..149be95 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -1810,12 +1810,25 @@ remove_bb (basic_block bb)
}
/* Remove all the instructions in the block. */
- for (i = bsi_start (bb); !bsi_end_p (i); bsi_remove (&i))
+ for (i = bsi_start (bb); !bsi_end_p (i);)
{
tree stmt = bsi_stmt (i);
- release_defs (stmt);
+ if (TREE_CODE (stmt) == LABEL_EXPR
+ && FORCED_LABEL (LABEL_EXPR_LABEL (stmt)))
+ {
+ basic_block new_bb = bb->prev_bb;
+ block_stmt_iterator new_bsi = bsi_after_labels (new_bb);
+
+ bsi_remove (&i);
+ bsi_insert_after (&new_bsi, stmt, BSI_NEW_STMT);
+ }
+ else
+ {
+ release_defs (stmt);
- set_bb_for_stmt (stmt, NULL);
+ set_bb_for_stmt (stmt, NULL);
+ bsi_remove (&i);
+ }
/* Don't warn for removed gotos. Gotos are often removed due to
jump threading, thus resulting in bogus warnings. Not great,
@@ -3403,8 +3416,9 @@ tree_verify_flow_info (void)
if (label_to_block (LABEL_EXPR_LABEL (bsi_stmt (bsi))) != bb)
{
+ tree stmt = bsi_stmt (bsi);
error ("Label %s to block does not match in bb %d\n",
- IDENTIFIER_POINTER (DECL_NAME (bsi_stmt (bsi))),
+ IDENTIFIER_POINTER (DECL_NAME (LABEL_EXPR_LABEL (stmt))),
bb->index);
err = 1;
}
@@ -3412,8 +3426,9 @@ tree_verify_flow_info (void)
if (decl_function_context (LABEL_EXPR_LABEL (bsi_stmt (bsi)))
!= current_function_decl)
{
+ tree stmt = bsi_stmt (bsi);
error ("Label %s has incorrect context in bb %d\n",
- IDENTIFIER_POINTER (DECL_NAME (bsi_stmt (bsi))),
+ IDENTIFIER_POINTER (DECL_NAME (LABEL_EXPR_LABEL (stmt))),
bb->index);
err = 1;
}