+/**
+ * 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 void remove_senseless_conds(ir_node *bl, void *data)
+{
+ int i, j;
+ int n = get_Block_n_cfgpreds(bl);
+
+ assert(is_Block(bl));
+
+ for (i = 0; i < n; ++i) {
+ ir_node *pred_i = get_Block_cfgpred(bl, i);
+ ir_node *cond_i = skip_Proj(pred_i);
+
+ 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
+ && get_irn_op(cond_i) == op_Cond
+ && get_irn_mode(get_Cond_selector(cond_i)) == mode_b) {
+
+ ir_node *jmp = new_r_Jmp(current_ir_graph, get_nodes_block(cond_i));
+ set_irn_n(bl, i, jmp);
+ set_irn_n(bl, j, new_Bad());
+
+ DBG_OPT_IFSIM2(cond_i, jmp);
+ break;
+ }
+ }
+ }
+}
+
+