From: Christian Helmer Date: Fri, 25 May 2012 14:01:49 +0000 (+0200) Subject: fixed bug where projections ended up in the wrong blocks X-Git-Url: http://nsz.repo.hu/git/?a=commitdiff_plain;h=2c4fc9d0492bad4b72124def353c84c5f57b2cd7;p=libfirm fixed bug where projections ended up in the wrong blocks --- diff --git a/ir/opt/gvn_pre.c b/ir/opt/gvn_pre.c index 019ddd6eb..79d737eef 100644 --- a/ir/opt/gvn_pre.c +++ b/ir/opt/gvn_pre.c @@ -563,10 +563,11 @@ static void compute_avail_top_down(ir_node *block, void *ctx) */ static ir_node *phi_translate(ir_node *node, ir_node *block, int pos) { - ir_node *nn; - ir_node **in; int i; int arity; + ir_node **in; + ir_node *nn; + ir_node *target_block; if (is_Phi(node)) { if (get_nodes_block(node) == block) { @@ -594,10 +595,17 @@ static ir_node *phi_translate(ir_node *node, ir_node *block, int pos) in[i] = trans; } + target_block = get_Block_cfgpred_block(block, pos); + if (is_Proj(node)) { + /* Projections are the sole case where we have to ensure + that they are in the same block as their tuple node. */ + target_block = get_nodes_block(in[0]); + } + nn = new_ir_node( get_irn_dbg_info(node), get_irn_irg(node), - get_Block_cfgpred_block(block, pos), + target_block, get_irn_op(node), get_irn_mode(node), arity,