X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fir%2Firopt.c;h=ce0e569753fbb68e35b6821bfef880f0b5b9e173;hb=19975388facbb3943fbc2aa2f5f9422350bb5cb3;hp=f7d6fee1bbf7ab738b91753d1ab569d3c4843974;hpb=c5d70d65bcf0210eb0137c9ab16fb9e443be5cc5;p=libfirm diff --git a/ir/ir/iropt.c b/ir/ir/iropt.c index f7d6fee1b..ce0e56975 100644 --- a/ir/ir/iropt.c +++ b/ir/ir/iropt.c @@ -494,19 +494,26 @@ static ir_node *equivalent_node_Block(ir_node *n) This should be true, as the block is matured before optimize is called. But what about Phi-cycles with the Phi0/Id that could not be resolved? Remaining Phi nodes are just Ids. */ - if ((get_Block_n_cfgpreds(n) == 1) && - (get_irn_op(get_Block_cfgpred(n, 0)) == op_Jmp) && - (get_opt_control_flow_straightening())) { - n = get_nodes_Block(get_Block_cfgpred(n, 0)); - if (n == oldn) { - /* Jmp jumps into the block it is in -- deal self cycle. */ - n = new_Bad(); DBG_OPT_DEAD; - } else { - DBG_OPT_STG; - } - - } else if ((get_Block_n_cfgpreds(n) == 2) && - (get_opt_control_flow_weak_simplification())) { + if ((get_Block_n_cfgpreds(n) == 1) && + (get_irn_op(get_Block_cfgpred(n, 0)) == op_Jmp)) { + ir_node *predblock = get_nodes_Block(get_Block_cfgpred(n, 0)); + if (predblock == oldn) { + /* Jmp jumps into the block it is in -- deal self cycle. */ + n = new_Bad(); DBG_OPT_DEAD; + } else if (get_opt_control_flow_straightening()) { + n = predblock; DBG_OPT_STG; + } + } + else if ((get_Block_n_cfgpreds(n) == 1) && + (get_irn_op(skip_Proj(get_Block_cfgpred(n, 0))) == op_Cond)) { + ir_node *predblock = get_nodes_Block(get_Block_cfgpred(n, 0)); + if (predblock == oldn) { + /* Jmp jumps into the block it is in -- deal self cycle. */ + n = new_Bad(); DBG_OPT_DEAD; + } + } + else if ((get_Block_n_cfgpreds(n) == 2) && + (get_opt_control_flow_weak_simplification())) { /* Test whether Cond jumps twice to this block @@@ we could do this also with two loops finding two preds from several ones. */ ir_node *a = get_Block_cfgpred(n, 0);