count executed optimization
[libfirm] / ir / ir / irgopt.c
index 1f552d9..0e98606 100644 (file)
@@ -1508,7 +1508,7 @@ static void collect_calls2(ir_node *call, void *ctx) {
 }
 
 /**
- * Returns TRUE if the number of callers in 0 in the irg's environment,
+ * Returns TRUE if the number of callers is 0 in the irg's environment,
  * hence this irg is a leave.
  */
 INLINE static int is_leave(ir_graph *irg) {
@@ -1517,7 +1517,8 @@ INLINE static int is_leave(ir_graph *irg) {
 }
 
 /**
- * Returns TRUE if the number of callers is smaller size in the irg's environment.
+ * Returns TRUE if the number of nodes in the callee is
+ * smaller then size in the irg's environment.
  */
 INLINE static int is_smaller(ir_graph *callee, int size) {
        inline_irg_env *env = get_irg_link(callee);
@@ -1964,9 +1965,7 @@ static ir_node *calc_dca(ir_node *dca, ir_node *block) {
  */
 static ir_node *consumer_dom_dca(ir_node *dca, ir_node *consumer, ir_node *producer)
 {
-       ir_node *block = NULL;
-
-       /* Compute the latest block into which we can place a node so that it is
+       /* Compute the last block into which we can place a node so that it is
           before consumer. */
        if (is_Phi(consumer)) {
                /* our consumer is a Phi-node, the effective use is in all those
@@ -1976,23 +1975,18 @@ static ir_node *consumer_dom_dca(ir_node *dca, ir_node *consumer, ir_node *produ
                int      i;
 
                for (i = 0;  i < arity; i++) {
-                       if (get_irn_n(consumer, i) == producer) {
-                               ir_node *new_block = get_nodes_block(get_Block_cfgpred(phi_block, i));
+                       if (get_Phi_pred(consumer, i) == producer) {
+                               ir_node *new_block = get_Block_cfgpred_block(phi_block, i);
 
                                if (!is_Block_unreachable(new_block))
-                                       block = calc_dca(block, new_block);
+                                       dca = calc_dca(dca, new_block);
                        }
                }
-
-               if (!block)
-                       block = get_nodes_block(producer);
        } else {
-               assert(!is_Block(consumer));
-               block = get_nodes_block(consumer);
+               dca = calc_dca(dca, get_nodes_block(consumer));
        }
 
-       /* Compute the deepest common ancestor of block and dca. */
-       return calc_dca(dca, block);
+       return dca;
 }
 
 /* FIXME: the name clashes here with the function from ana/field_temperature.c
@@ -2202,7 +2196,7 @@ void place_code(ir_graph *irg) {
 
        if (1 || get_irg_loopinfo_state(irg) != loopinfo_consistent) {
                free_loop_information(irg);
-               construct_backedges(irg);
+               construct_cf_backedges(irg);
        }
 
        /* Place all floating nodes as early as possible. This guarantees