Added new global var that represents the
[libfirm] / ir / ir / iropt.c
index b5e5526..7da9a0b 100644 (file)
@@ -21,7 +21,7 @@
 # include "tv.h"
 # include "tune.h"
 # include "dbginfo_t.h"
-# include "iropt_dbg.c"
+# include "iropt_dbg.h"
 
 /* Make types visible to allow most efficient access */
 # include "entity_t.h"
@@ -44,7 +44,7 @@ value_of (ir_node *n)
     return tarval_bad;
 }
 
-/* if n can be computed, return the value, else NULL. Performs
+/* if n can be computed, return the value, else tarval_bad. Performs
    constant folding. GL: Only if n is arithmetic operator? */
 tarval *
 computed_value (ir_node *n)
@@ -389,9 +389,9 @@ equivalent_node (ir_node *n)
     ir_node *on;
     /* After running compute_node there is only one constant predecessor.
        Find this predecessors value and remember the other node: */
-    if ((tv = computed_value (a))) {
+    if ((tv = computed_value (a)) != tarval_bad) {
       on = b;
-    } else if ((tv = computed_value (b))) {
+    } else if ((tv = computed_value (b)) != tarval_bad) {
       on = a;
     } else break;
 
@@ -730,11 +730,11 @@ transform_node (ir_node *n)
       jmp = new_r_Jmp(current_ir_graph, get_nodes_Block(n));
       turn_into_tuple(n, 2);
       if (ta == tarval_b_true) {
-               set_Tuple_pred(n, 0, new_Bad());
-               set_Tuple_pred(n, 1, jmp);
+       set_Tuple_pred(n, 0, new_Bad());
+       set_Tuple_pred(n, 1, jmp);
       } else {
-               set_Tuple_pred(n, 0, jmp);
-               set_Tuple_pred(n, 1, new_Bad());
+       set_Tuple_pred(n, 0, jmp);
+       set_Tuple_pred(n, 1, new_Bad());
       }
       /* We might generate an endless loop, so keep it alive. */
       add_End_keepalive(get_irg_end(current_ir_graph), get_nodes_Block(n));