do not kill unreachable code in gcse
authorMatthias Braun <matze@braunis.de>
Fri, 29 Apr 2011 11:11:58 +0000 (13:11 +0200)
committerMatthias Braun <matze@braunis.de>
Fri, 29 Apr 2011 11:13:56 +0000 (13:13 +0200)
ir/ir/irgopt.c

index 499269e..de85ed1 100644 (file)
@@ -182,15 +182,20 @@ int optimize_graph_df(ir_graph *irg)
 
        state = edges_assure(irg);
 
-       if (get_opt_global_cse())
-               set_irg_pinned(irg, op_pin_state_floats);
-       set_irg_state(irg, IR_GRAPH_STATE_BAD_BLOCK);
-
        /* Clean the value_table in irg for the CSE. */
        new_identities(irg);
 
-       if (get_irg_dom_state(irg) == dom_consistent)
-               irg_block_walk_graph(irg, NULL, kill_dead_blocks, NULL);
+       if (get_opt_global_cse()) {
+               set_irg_pinned(irg, op_pin_state_floats);
+       } else {
+               /* The following enables unreachable code elimination (=Blocks may be
+                * Bad). We cannot enable it in global_cse nodes since we can't
+                * determine a nodes block there and therefore can't remove all code
+                * in unreachable blocks */
+               set_irg_state(irg, IR_GRAPH_STATE_BAD_BLOCK);
+               if (get_irg_dom_state(irg) == dom_consistent)
+                       irg_block_walk_graph(irg, NULL, kill_dead_blocks, NULL);
+       }
 
        /* invalidate info */
        set_irg_outs_inconsistent(irg);