X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fopt%2Freturn.c;h=ebfb2f3c3e5f6df3fc7e07dd662fdc3b6e549e0b;hb=ba4016c7aa0437c72ef7323ecea585828bdc038b;hp=99750cdf271cc06aea4ed716f0a53895e75cf928;hpb=21fea113a8065a9d91c649151f38acf2c72cea62;p=libfirm diff --git a/ir/opt/return.c b/ir/opt/return.c index 99750cdf2..ebfb2f3c3 100644 --- a/ir/opt/return.c +++ b/ir/opt/return.c @@ -62,8 +62,9 @@ void normalize_one_return(ir_graph *irg) { int i, j, k, n, last_idx, n_rets, n_ret_vals = -1; unsigned char *returns; ir_node **in, **retvals, **endbl_in; - ir_node *block; + int filter_dbgi = 0; + dbg_info *combined_dbgi = NULL; /* look, if we have more than one return */ n = get_Block_n_cfgpreds(endbl); @@ -79,6 +80,17 @@ void normalize_one_return(ir_graph *irg) { ir_node *node = get_Block_cfgpred(endbl, i); if (is_Return(node)) { + dbg_info *dbgi = get_irn_dbg_info(node); + + if (dbgi != NULL && dbgi != combined_dbgi) { + if (filter_dbgi) { + combined_dbgi = NULL; + } else { + combined_dbgi = dbgi; + filter_dbgi = 1; + } + } + ++n_rets; set_bit(i); @@ -140,7 +152,7 @@ void normalize_one_return(ir_graph *irg) { in[i] = new_r_Phi(irg, block, n_rets, &retvals[j], get_irn_mode(retvals[j])); } - endbl_in[last_idx++] = new_r_Return(irg, block, in[0], n_ret_vals-1, &in[1]); + endbl_in[last_idx++] = new_rd_Return(combined_dbgi, irg, block, in[0], n_ret_vals-1, &in[1]); set_irn_in(endbl, last_idx, endbl_in); @@ -186,7 +198,8 @@ static int can_move_ret(ir_node *ret) { /* check, that predecessors are Jmps */ n = get_Block_n_cfgpreds(retbl); - if (n <= 1) + /* we cannot move above a labeled block, as this might kill the block */ + if (n <= 1 || has_Block_label(retbl)) return 0; for (i = 0; i < n; ++i) { ir_node *pred = get_Block_cfgpred(retbl, i);