fix last fix (+ optimisation: don't do anything if copy and orig are the same)
authorMatthias Braun <matze@braunis.de>
Mon, 6 Oct 2008 20:44:07 +0000 (20:44 +0000)
committerMatthias Braun <matze@braunis.de>
Mon, 6 Oct 2008 20:44:07 +0000 (20:44 +0000)
[r22552]

ir/opt/condeval.c

index d3b29d7..cc61e3d 100644 (file)
@@ -85,12 +85,6 @@ static ir_node *search_def_and_create_phis(ir_node *block, ir_mode *mode,
        if(is_Bad(block))
                return new_Bad();
 
-       /* already processed this block? */
-       if(irn_visited(block)) {
-               ir_node *value = (ir_node*) get_irn_link(block);
-               return value;
-       }
-
        /* the other defs can't be marked for cases where a user of the original
         * value is in the same block as the alternative definition.
         * In this case we mustn't use the alternative definition.
@@ -100,6 +94,12 @@ static ir_node *search_def_and_create_phis(ir_node *block, ir_mode *mode,
                return ssa_second_def;
        }
 
+       /* already processed this block? */
+       if(irn_visited(block)) {
+               ir_node *value = (ir_node*) get_irn_link(block);
+               return value;
+       }
+
        irg = get_irn_irg(block);
        assert(block != get_irg_start_block(irg));
 
@@ -147,6 +147,10 @@ static void construct_ssa(ir_node *orig_block, ir_node *orig_val,
        const ir_edge_t *edge;
        const ir_edge_t *next;
 
+       /* no need to do anything */
+       if (orig_val == second_val)
+               return;
+
        irg = get_irn_irg(orig_val);
        inc_irg_visited(irg);