X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fir%2Firopt.c;h=e02a230d15b0df590f1fa679e42f978b989bb032;hb=8518628459833d02e553bfbf126c5050aeddc326;hp=b98c922bf5f147e1e8a0af81ccffb59729b17aea;hpb=430d8902a122c207178e4d40b54c09fbb3a4da38;p=libfirm diff --git a/ir/ir/iropt.c b/ir/ir/iropt.c index b98c922bf..e02a230d1 100644 --- a/ir/ir/iropt.c +++ b/ir/ir/iropt.c @@ -178,7 +178,7 @@ static tarval *computed_value_Minus(ir_node *n) { ir_node *a = get_Minus_op(n); tarval *ta = value_of(a); - if ((ta != tarval_bad) && mode_is_signed(get_irn_mode(a))) + if (ta != tarval_bad) return tarval_neg(ta); return tarval_bad; @@ -1200,7 +1200,7 @@ static ir_node *equivalent_node_Conv(ir_node *n) { n = b; /* Convb(Conv*(xxxb(...))) == xxxb(...) */ DBG_OPT_ALGSIM1(oldn, a, b, n, FS_OPT_CONV); } else if (mode_is_int(n_mode)) { - if (smaller_mode(b_mode, a_mode)){ + if (get_mode_size_bits(b_mode) <= get_mode_size_bits(a_mode)) { n = b; /* ConvS(ConvL(xxxS(...))) == xxxS(...) */ DBG_OPT_ALGSIM1(oldn, a, b, n, FS_OPT_CONV); } @@ -3177,6 +3177,9 @@ static ir_node *transform_node_Not(ir_node *n) { * Optimize: * -(~x) = x + 1 * -(a-b) = b - a + * -(a >>u (size-1)) = a >>s (size-1) + * -(a >>s (size-1)) = a >>u (size-1) + * -(a * const) -> a * -const */ static ir_node *transform_node_Minus(ir_node *n) { ir_node *c, *oldn = n; @@ -3252,6 +3255,7 @@ static ir_node *transform_node_Minus(ir_node *n) { ir_graph *irg = current_ir_graph; ir_node *block = get_nodes_block(a); n = new_rd_Mul(dbg, irg, block, mul_l, cnst, mode); + DBG_OPT_ALGSIM2(oldn, a, n, FS_OPT_MINUS_MUL_C); return n; } } @@ -3657,10 +3661,12 @@ static ir_node *transform_node_Proj_Cmp(ir_node *proj) { */ if (is_Const(right)) { c = right; - } else if (is_Const(left)) { + } else if (is_irn_constlike(left)) { c = left; left = right; right = c; + if(!is_Const(c)) + c = NULL; proj_nr = get_inversed_pnc(proj_nr); changed |= 1;