improved detection of pure and const functions (now works for recursive one of any...
[libfirm] / ir / opt / opt_osr.c
index df0b18d..27d34e9 100644 (file)
@@ -355,8 +355,8 @@ static ir_node *reduce(ir_node *orig, ir_node *iv, ir_node *rc, iv_env *env) {
 
                result = exact_copy(iv);
 
-               /* Beware: we must always create a new nduction variable with the same mode
-                  as the node we are replacing. Espicially this means the mode might be changed
+               /* Beware: we must always create a new induction variable with the same mode
+                  as the node we are replacing. Especially this means the mode might be changed
                   from P to I and back. This is always possible, because we have only Phi, Add
                   and Sub nodes. */
                set_irn_mode(result, mode);
@@ -914,7 +914,7 @@ static ir_node *applyOneEdge(ir_node *rc, LFTR_edge *e, iv_env *env) {
                        DB((dbg, LEVEL_4, " = OVERFLOW"));
                        return NULL;
                }
-               return new_r_Const(current_ir_graph, get_nodes_block(rc), get_tarval_mode(tv), tv);
+               return new_r_Const(current_ir_graph, get_irn_n(rc, -1), get_tarval_mode(tv), tv);
        }
        return do_apply(e->code, NULL, rc, e->rc, get_irn_mode(rc));
 }
@@ -1020,10 +1020,9 @@ static void clear_and_fix(ir_node *irn, void *env)
        (void) env;
        set_irn_link(irn, NULL);
 
-       /* FIXME: must be removed but edges must be fixed first*/
        if (is_Proj(irn)) {
                ir_node *pred = get_Proj_pred(irn);
-               set_irn_n(irn, -1, get_nodes_block(pred));
+               set_nodes_block(irn, get_nodes_block(pred));
        }
 }