Fixed a bug
[libfirm] / ir / ir / irgopt.c
index 2397685..0ec7ad2 100644 (file)
@@ -1714,18 +1714,25 @@ place_floats_late(ir_node *n, pdeq *worklist)
                    dominator tree of all nodes'
                    blocks depending on us; our final
                    placement has to dominate DCA. */
-      for (i = 0; i < get_irn_n_outs(n); ++i) {
+      for (i = get_irn_n_outs(n) - 1; i >= 0; --i) {
         ir_node *out = get_irn_out(n, i);
 
+        if (get_irn_op(out) == op_End) {
+          /*
+           * This consumer is the End node, a keep alive edge.
+           * This is not a real consumer, so we ignore it
+           */
+          continue;
+        }
+
         /* ignore if out is in dead code */
-        ir_node *outbl = get_nodes_block(out);
+        ir_node *outbl = get_irn_n(out, -1);
         if (is_Block_unreachable(outbl))
           continue;
         dca = consumer_dom_dca(dca, out, n);
       }
       if (dca) {
         set_nodes_block(n, dca);
-
         move_out_of_loops (n, early);
       }
       /* else all outs are in dead code */