# include "config.h"
#endif
+#include "iroptimize.h"
+
#include <assert.h>
#include "plist.h"
#include "irflag_t.h"
#include "firmstat.h"
-#include "cfopt.h"
#include "iropt_dbg.h"
/*------------------------------------------------------------------*/
/* 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. */
/*------------------------------------------------------------------*/
/**
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) {
+ if (op == op_Phi && get_irn_arity(n) > 0) {
/* Collect Phi nodes to compact ins along with block's ins. */
set_irn_link(n, get_irn_link(b));
set_irn_link(b, n);