and again
[libfirm] / ir / opt / combo.c
index 2fc87e3..099091c 100644 (file)
@@ -50,6 +50,7 @@
 #include "irgmod.h"
 #include "iropt_dbg.h"
 #include "debug.h"
+#include "array_t.h"
 #include "error.h"
 
 #include "tv_t.h"
@@ -222,6 +223,7 @@ static void check_all_partitions(environment_t *env) {
        partition_t *P;
        node_t      *node;
 
+#ifdef DEBUG_libfirm
        for (P = env->dbg_list; P != NULL; P = P->dbg_next) {
                check_partition(P);
                list_for_each_entry(node_t, node, &P->Follower, node_list) {
@@ -230,6 +232,7 @@ static void check_all_partitions(environment_t *env) {
                        assert(leader != node && leader->part == node->part);
                }
        }
+#endif
 }
 
 /**
@@ -497,6 +500,7 @@ static INLINE tarval *get_node_tarval(const ir_node *irn) {
  */
 static INLINE void add_to_worklist(partition_t *X, environment_t *env) {
        assert(X->on_worklist == 0);
+       DB((dbg, LEVEL_2, "Adding part%d to worklist\n", X->nr));
        X->wl_next     = env->worklist;
        X->on_worklist = 1;
        env->worklist  = X;
@@ -2549,9 +2553,6 @@ static void propagate(environment_t *env) {
                if (old_type_was_T_or_C) {
                        node_t *y, *tmp;
 
-                       if (Y->on_worklist == 0)
-                               add_to_worklist(Y, env);
-
                        /* check if some nodes will make the leader -> follower transition */
                        list_for_each_entry_safe(node_t, y, tmp, &Y->Leader, node_list) {
                                if (y->type.tv != tarval_top && ! is_con(y->type)) {
@@ -2910,7 +2911,7 @@ static void apply_end(ir_node *end, environment_t *env) {
                if (! is_Block(ka))
                        node = get_irn_node(get_nodes_block(ka));
 
-               if (node->type.tv != tarval_unreachable)
+               if (node->type.tv != tarval_unreachable && !is_Bad(ka))
                        in[j++] = ka;
        }
        if (j != n) {
@@ -2956,11 +2957,13 @@ static void set_compute_functions(void) {
 }  /* set_compute_functions */
 
 static int dump_partition_hook(FILE *F, ir_node *n, ir_node *local) {
+#ifdef DEBUG_libfirm
        ir_node *irn = local != NULL ? local : n;
        node_t *node = get_irn_node(irn);
 
        ir_fprintf(F, "info2 : \"partition %u type %+F\"\n", node->part->nr, node->type);
        return 1;
+#endif
 }
 
 void combo(ir_graph *irg) {
@@ -2995,7 +2998,6 @@ void combo(ir_graph *irg) {
        assure_irg_outs(irg);
        assure_cf_loop(irg);
 
-
        /* we have our own value_of function */
        set_value_of_func(get_node_tarval);