-/*------------------------------------------------------------------*/
-/* Control flow optimization. */
-/* */
-/* Removes Bad control flow predecessors and empty blocks. A block */
-/* is empty if it contains only a Jmp node. */
-/* Blocks can only be removed if they are not needed for the */
-/* semantics of Phi nodes. */
-/* Further, we NEVER remove labeled blocks (even if we could move */
-/* the label. */
-/*------------------------------------------------------------------*/
-
-#define set_Block_removable(block) set_Block_mark(block, 1)
-#define set_Block_non_removable(block) set_Block_mark(block, 0)
-#define is_Block_removable(block) (get_Block_mark(block) != 0)
-
-/**
- * Replace binary Conds that jumps twice into the same block
- * by a simple Jmp.
- * E.g.
- * @verbatim
- * Cond Jmp Bad
- * / \ | /
- * ProjX True ProjX False ==> | /
- * \ / | /
- * Block Block
- * @endverbatim
- *
- * Such pattern are the result of if-conversion.
- *
- * Note that the simple case that Block has only these two
- * predecessors are already handled in equivalent_node_Block().
- */
-static int remove_senseless_conds(ir_node *bl)
-{
- int i, j;
- int n = get_Block_n_cfgpreds(bl);
- int changed = 0;
-
- for (i = 0; i < n; ++i) {
- ir_node *pred_i = get_Block_cfgpred(bl, i);
- ir_node *cond_i = skip_Proj(pred_i);
-
- /* binary Cond */
- if (is_Cond(cond_i) && get_irn_mode(get_Cond_selector(cond_i)) == mode_b) {
-
- for (j = i + 1; j < n; ++j) {
- ir_node *pred_j = get_Block_cfgpred(bl, j);
- ir_node *cond_j = skip_Proj(pred_j);
-
- if (cond_j == cond_i) {
- ir_node *jmp = new_r_Jmp(get_nodes_block(cond_i));
- set_irn_n(bl, i, jmp);
- set_irn_n(bl, j, new_Bad());
-
- DBG_OPT_IFSIM2(cond_i, jmp);
- changed = 1;
- break;
- }
- }
- }
- }
- return changed;
-}
-