X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fir%2Firopt.c;h=d9b29661125427ebe60319cd10a5662ff2a6b0d7;hb=909ba29ec689920f4184b1b197b09fd49e451461;hp=28df36c9623ddc6e1e36480cf32c242d326fcf87;hpb=5022905bace816183da531dfe0efbee3196ccd9e;p=libfirm diff --git a/ir/ir/iropt.c b/ir/ir/iropt.c index 28df36c96..d9b296611 100644 --- a/ir/ir/iropt.c +++ b/ir/ir/iropt.c @@ -1219,16 +1219,15 @@ restart: goto restart; } /* else both are strict conv, second is superfluous */ - } else if (is_Proj(a)) { - ir_node *pred = get_Proj_pred(a); - if (is_Load(pred)) { - /* loads always return with the exact precision of n_mode */ - assert(get_Load_mode(pred) == n_mode); - return a; - } - /* leave strict floating point Conv's */ - return n; } else { + if (is_Proj(a)) { + ir_node *pred = get_Proj_pred(a); + if (is_Load(pred)) { + /* loads always return with the exact precision of n_mode */ + assert(get_Load_mode(pred) == n_mode); + return a; + } + } /* leave strict floating point Conv's */ return n; } @@ -2718,7 +2717,8 @@ static ir_node *transform_node_Mul(ir_node *n) { if (get_mode_arithmetic(mode) == irma_ieee754) { if (is_Const(a)) { tarval *tv = get_Const_tarval(a); - if (tarval_ieee754_get_exponent(tv) == 1 && tarval_ieee754_zero_mantissa(tv)) { + if (tarval_ieee754_get_exponent(tv) == 1 && tarval_ieee754_zero_mantissa(tv) + && !tarval_is_negative(tv)) { /* 2.0 * b = b + b */ n = new_rd_Add(get_irn_dbg_info(n), current_ir_graph, get_nodes_block(n), b, b, mode); DBG_OPT_ALGSIM1(oldn, a, b, n, FS_OPT_ADD_A_A); @@ -2727,7 +2727,8 @@ static ir_node *transform_node_Mul(ir_node *n) { } else if (is_Const(b)) { tarval *tv = get_Const_tarval(b); - if (tarval_ieee754_get_exponent(tv) == 1 && tarval_ieee754_zero_mantissa(tv)) { + if (tarval_ieee754_get_exponent(tv) == 1 && tarval_ieee754_zero_mantissa(tv) + && !tarval_is_negative(tv)) { /* a * 2.0 = a + a */ n = new_rd_Add(get_irn_dbg_info(n), current_ir_graph, get_nodes_block(n), a, a, mode); DBG_OPT_ALGSIM1(oldn, a, b, n, FS_OPT_ADD_A_A); @@ -5499,10 +5500,12 @@ static ir_node *transform_node_Mux(ir_node *n) { if (pn == pn_Cmp_Lg) { /* Mux((a & 2^C) != 0, 2^C, 0) */ n = cmp_l; + DBG_OPT_ALGSIM1(oldn, cmp, sel, n, FS_OPT_MUX_TO_BITOP); } else { /* Mux((a & 2^C) == 0, 2^C, 0) */ n = new_rd_Eor(get_irn_dbg_info(n), current_ir_graph, block, cmp_l, t, mode); + DBG_OPT_ALGSIM1(oldn, cmp, sel, n, FS_OPT_MUX_TO_BITOP); } return n; } @@ -5514,10 +5517,12 @@ static ir_node *transform_node_Mux(ir_node *n) { if (pn == pn_Cmp_Lg) { /* (a & (1 << n)) != 0, (1 << n), 0) */ n = cmp_l; + DBG_OPT_ALGSIM1(oldn, cmp, sel, n, FS_OPT_MUX_TO_BITOP); } else { /* (a & (1 << n)) == 0, (1 << n), 0) */ n = new_rd_Eor(get_irn_dbg_info(n), current_ir_graph, block, cmp_l, t, mode); + DBG_OPT_ALGSIM1(oldn, cmp, sel, n, FS_OPT_MUX_TO_BITOP); } return n; } @@ -5531,10 +5536,12 @@ static ir_node *transform_node_Mux(ir_node *n) { if (pn == pn_Cmp_Lg) { /* ((1 << n) & a) != 0, (1 << n), 0) */ n = cmp_l; + DBG_OPT_ALGSIM1(oldn, cmp, sel, n, FS_OPT_MUX_TO_BITOP); } else { /* ((1 << n) & a) == 0, (1 << n), 0) */ n = new_rd_Eor(get_irn_dbg_info(n), current_ir_graph, block, cmp_l, t, mode); + DBG_OPT_ALGSIM1(oldn, cmp, sel, n, FS_OPT_MUX_TO_BITOP); } return n; } @@ -5736,12 +5743,17 @@ static int node_cmp_attr_Call(ir_node *a, ir_node *b) { static int node_cmp_attr_Sel(ir_node *a, ir_node *b) { const ir_entity *a_ent = get_Sel_entity(a); const ir_entity *b_ent = get_Sel_entity(b); +#if 0 return (a_ent->kind != b_ent->kind) || (a_ent->name != b_ent->name) || (a_ent->owner != b_ent->owner) || (a_ent->ld_name != b_ent->ld_name) || (a_ent->type != b_ent->type); +#endif + /* Matze: inlining of functions can produce 2 entities with same type, + * name, etc. */ + return a_ent != b_ent; } /* node_cmp_attr_Sel */ /** Compares the attributes of two Phi nodes. */