fehler66 (more unsigned int -> double magic)
[libfirm] / ir / opt / cfopt.c
index b504e6f..e5380d9 100644 (file)
@@ -27,6 +27,8 @@
 # include "config.h"
 #endif
 
+#include "iroptimize.h"
+
 #include <assert.h>
 
 #include "plist.h"
@@ -51,7 +53,6 @@
 #include "irflag_t.h"
 #include "firmstat.h"
 
-#include "cfopt.h"
 #include "iropt_dbg.h"
 
 /*------------------------------------------------------------------*/
@@ -61,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.                                                       */
 /*------------------------------------------------------------------*/
 
 /**
@@ -225,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) {