- mostly implemented access to outer frame variables, however offset, is wrong yet
[libfirm] / ir / be / beirgmod.c
index 0023c2d..5e4b051 100644 (file)
@@ -184,10 +184,23 @@ static void remove_empty_block(ir_node *block)
 
                assert(succ_block == NULL);
                succ_block = get_edge_src_irn(edge);
+               if (has_Block_label(succ_block) && has_Block_label(block)) {
+                       /*
+                        * Currently we can add only one label for a block.
+                        * Therefore we cannot combine them if  both block already have one.
+                        */
+                       goto check_preds;
+               }
 
                set_irn_n(succ_block, pos, pred);
        }
 
+       if (has_Block_label(block)) {
+               /* move the label to the successor block */
+               ir_label_t label = get_Block_label(block);
+               set_Block_label(succ_block, label);
+       }
+
        /* there can be some non-scheduled Pin nodes left in the block, move them
         * to the succ block (Pin) or pred block (Sync) */
        foreach_out_edge_safe(block, edge, next) {
@@ -217,12 +230,6 @@ static void remove_empty_block(ir_node *block)
                panic("Unexpected node %+F in block %+F with empty schedule", node, block);
        }
 
-       if (has_Block_label(block)) {
-               /* move the label to the successor block */
-               ir_label_t label = get_Block_label(block);
-               set_Block_label(succ_block, label);
-       }
-
        set_Block_cfgpred(block, 0, new_Bad());
        kill_node(jump);
        blocks_removed = 1;