From 219a43ae7de85cb52c63c6cf195fe97f66e36c64 Mon Sep 17 00:00:00 2001 From: Michael Beck Date: Tue, 24 Jul 2007 16:54:10 +0000 Subject: [PATCH] mark labelled blocks as non-empty, preventing them to be removed [r15324] --- ir/opt/cfopt.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ir/opt/cfopt.c b/ir/opt/cfopt.c index 6fa73c7bf..e5380d9d4 100644 --- a/ir/opt/cfopt.c +++ b/ir/opt/cfopt.c @@ -62,6 +62,8 @@ /* is empty if it contains only a Jmp node. */ /* Blocks can only be removed if they are not needed for the */ /* semantics of Phi nodes. */ +/* Further, we NEVER remove labeled blocks (even if we could move */ +/* the label. */ /*------------------------------------------------------------------*/ /** @@ -226,7 +228,11 @@ static void collect_nodes(ir_node *n, void *ctx) { ir_op *op = get_irn_op(n); merge_env *env = ctx; - if (op != op_Block) { + if (op == op_Block) { + /* mark the block as non-empty if it is labelled */ + if (has_Block_label(n)) + mark_Block_block_visited(n); + } else { ir_node *b = get_nodes_block(n); if (op == op_Phi) { -- 2.20.1