X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fir%2Firopt.c;h=2bfb87c9ab6e44f13a9f36fc0b3f6e4119054748;hb=c71681c22466590a76c12aa0fdc805cb837af2a0;hp=219c7d72add8b12fa4caee8cd7bf446ae21df125;hpb=b597c7fd473086ca6374b2abbdf129f595c156d0;p=libfirm diff --git a/ir/ir/iropt.c b/ir/ir/iropt.c index 219c7d72a..2bfb87c9a 100644 --- a/ir/ir/iropt.c +++ b/ir/ir/iropt.c @@ -1259,8 +1259,7 @@ restart: } } } - if (get_mode_arithmetic(n_mode) == irma_twos_complement && - get_mode_arithmetic(a_mode) == irma_ieee754) { + if (mode_is_int(n_mode) && get_mode_arithmetic(a_mode) == irma_ieee754) { /* ConvI(ConvF(I)) -> I, iff float mantissa >= int mode */ unsigned int_mantissa = get_mode_size_bits(n_mode) - (mode_is_signed(n_mode) ? 1 : 0); unsigned float_mantissa = tarval_ieee754_get_mantissa_size(a_mode); @@ -1863,10 +1862,11 @@ static int is_const_Phi(ir_node *n) { if (! is_Phi(n) || get_irn_arity(n) == 0) return 0; - for (i = get_irn_arity(n) - 1; i >= 0; --i) + for (i = get_irn_arity(n) - 1; i >= 0; --i) { if (! is_Const(get_irn_n(n, i))) return 0; - return 1; + } + return 1; } /* is_const_Phi */ typedef tarval *(*tarval_sub_type)(tarval *a, tarval *b, ir_mode *mode); @@ -4341,7 +4341,7 @@ static ir_node *transform_node_Proj_Cmp(ir_node *proj) { else if (proj_nr == pn_Cmp_Le || proj_nr == pn_Cmp_Lt) { if (tv != tarval_bad) { /* c >= 0 : Abs(a) <= c ==> (unsigned)(a + c) <= 2*c */ - if (get_irn_op(left) == op_Abs) { // TODO something is missing here + if (is_Abs(left)) { // TODO something is missing here } } } @@ -5280,7 +5280,11 @@ static ir_node *transform_node_Conv(ir_node *n) { ir_node *c, *oldn = n; ir_node *a = get_Conv_op(n); - if (is_const_Phi(a)) { + if (get_irn_mode(n) != mode_b && is_const_Phi(a)) { + /* Do NOT optimize mode_b Conv's, this leads to remaining + * Phib nodes later, because the conv_b_lower operation + * is instantly reverted, when it tries to insert a Convb. + */ c = apply_conv_on_phi(a, get_irn_mode(n)); if (c) { DBG_OPT_ALGSIM0(oldn, c, FS_OPT_CONST_PHI);