if (get_opt_global_cse()) {
set_irg_pinned(irg, op_pin_state_floats);
- } else {
- /* The following enables unreachable code elimination (=Blocks may be
- * Bad). We cannot enable it in global_cse nodes since we can't
- * determine a nodes block there and therefore can't remove all code
- * in unreachable blocks */
- set_irg_state(irg, IR_GRAPH_STATE_BAD_BLOCK);
- if (get_irg_dom_state(irg) == dom_consistent)
- irg_block_walk_graph(irg, NULL, kill_dead_blocks, NULL);
}
+ /* The following enables unreachable code elimination (=Blocks may be
+ * Bad). We cannot enable it in global_cse nodes since we can't
+ * determine a nodes block there and therefore can't remove all code
+ * in unreachable blocks */
+ set_irg_state(irg, IR_GRAPH_STATE_BAD_BLOCK);
+ if (get_irg_dom_state(irg) == dom_consistent)
+ irg_block_walk_graph(irg, NULL, kill_dead_blocks, NULL);
+
/* invalidate info */
set_irg_outs_inconsistent(irg);
set_irg_doms_inconsistent(irg);
{
ir_op *op = get_irn_op(node);
- /* Nodes in bad blocks are bad.
- * Beware: we can only read the block of a non-floating node. */
- if (op != op_Block && is_irn_pinned_in_irg(node)
- && is_Bad(get_nodes_block(node))) {
+ /* Code in "Bad" blocks is unreachable and can be replaced by Bad */
+ if (op != op_Block && is_Bad(get_nodes_block(node))) {
ir_graph *irg = get_irn_irg(node);
return get_irg_bad(irg);
}
}
return node;
-} /* gigo */
+}
/**
* These optimizations deallocate nodes from the obstack.
return get_Block_dom_depth(block) >= 0;
}
-/* mark node as not-visited */
-static void clear_irn_visited(ir_node *node)
-{
- ir_graph *irg = get_irn_irg(node);
- ir_visited_t visited = get_irg_visited(irg);
- set_irn_visited(node, visited-1);
-}
-
/**
* Find the earliest correct block for node n. --- Place n into the
* same Block as its dominance-deepest Input.
arity = get_irn_arity(n);
place_floats_early(block, worklist);
for (i = 0; i < arity; ++i) {
- ir_node *pred = get_irn_n(n, i);
- ir_node *pred_block = get_nodes_block(pred);
-
- /* gcse can lead to predecessors of reachable code being unreachable.
- * Move them into the current block in this case */
- if (!is_block_reachable(pred_block)) {
- ir_node *new_pred_block = block;
- assert(get_irn_pinned(pred) == op_pin_state_floats);
- if (is_Phi(n)) {
- new_pred_block = get_Block_cfgpred_block(block, i);
- }
- set_nodes_block(pred, new_pred_block);
- clear_irn_visited(pred);
- }
+ ir_node *pred = get_irn_n(n, i);
place_floats_early(pred, worklist);
}