Set the outs to inconsistent at the end of transform_irg().
[libfirm] / ir / ir / irgopt.c
index 0e98606..52be875 100644 (file)
@@ -412,7 +412,7 @@ static void copy_preds(ir_node *n, void *env) {
                                exchange(nn, old);
                        }
                }
-       } else if (is_Phi(n)) {
+       } else if (is_Phi(n) && get_irn_arity(n) > 0) {
                /* Don't copy node if corresponding predecessor in block is Bad.
                   The Block itself should not be Bad. */
                block = get_nodes_block(n);
@@ -615,7 +615,9 @@ void
 dead_node_elimination(ir_graph *irg) {
        if (get_opt_optimize() && get_opt_dead_node_elimination()) {
                ir_graph *rem;
+#ifdef INTERPROCEDURAL_VIEW
                int rem_ipview = get_interprocedural_view();
+#endif
                struct obstack *graveyard_obst = NULL;
                struct obstack *rebirth_obst   = NULL;
                assert(! edges_activated(irg) && "dead node elimination requires disabled edges");
@@ -626,7 +628,9 @@ dead_node_elimination(ir_graph *irg) {
                /* Remember external state of current_ir_graph. */
                rem = current_ir_graph;
                current_ir_graph = irg;
+#ifdef INTERPROCEDURAL_VIEW
                set_interprocedural_view(0);
+#endif
 
                assert(get_irg_phase_state(irg) != phase_building);
 
@@ -665,7 +669,9 @@ dead_node_elimination(ir_graph *irg) {
                hook_dead_node_elim(irg, 0);
 
                current_ir_graph = rem;
+#ifdef INTERPROCEDURAL_VIEW
                set_interprocedural_view(rem_ipview);
+#endif
        }
 }
 
@@ -2253,7 +2259,8 @@ static void walk_critical_cf_edges(ir_node *n, void *env) {
                                        goto insert;
                                continue;
                        }
-                       if (is_op_forking(cfop)) {
+                       /* we don't want place nodes in the start block, so handle it like forking */
+                       if (is_op_forking(cfop) || cfop == op_Start) {
                                /* Predecessor has multiple successors. Insert new control flow edge edges. */
 insert:
                                /* set predecessor of new block */