- if (get_Block_n_cfgpreds(n) == 1
- && get_irn_op(get_Block_cfgpred(n, 0)) == op_Jmp) {
- n = get_nodes_Block(get_Block_cfgpred(n, 0));
-
- } else if ((n != current_ir_graph->start_block) &&
+ if ((get_Block_n_cfgpreds(n) == 1) &&
+ (get_irn_op(get_Block_cfgpred(n, 0)) == op_Jmp) &&
+ (get_opt_control_flow())) {
+ n = get_nodes_Block(get_Block_cfgpred(n, 0)); DBG_OPT_STG;
+
+ } else if ((get_Block_n_cfgpreds(n) == 2) &&
+ (get_opt_control_flow())) {
+ /* Test whether Cond jumps twice to this block
+ @@@ we could do this also with two loops finding two preds from several ones. */
+ a = get_Block_cfgpred(n, 0);
+ b = get_Block_cfgpred(n, 1);
+ if ((get_irn_op(a) == op_Proj) &&
+ (get_irn_op(b) == op_Proj) &&
+ (get_Proj_pred(a) == get_Proj_pred(b)) &&
+ (get_irn_op(get_Proj_pred(a)) == op_Cond) &&
+ (get_irn_mode(get_Cond_selector(get_Proj_pred(a))) == mode_b)) {
+ /* Also a single entry Block following a single exit Block. Phis have
+ twice the same operand and will be optimized away. */
+ n = get_nodes_Block(a); DBG_OPT_IFSIM;
+ }
+ } else if (get_opt_unreachable_code() &&
+ (n != current_ir_graph->start_block) &&