Merge branch 'master' into v2.1

This commit is contained in:
Mike Pall 2015-03-02 17:34:33 +01:00
commit 2c0748f691

View File

@ -1167,11 +1167,16 @@ LJFOLDF(simplify_conv_flt_num)
LJFOLD(TOBIT CONV KNUM) LJFOLD(TOBIT CONV KNUM)
LJFOLDF(simplify_tobit_conv) LJFOLDF(simplify_tobit_conv)
{ {
if ((fleft->op2 & IRCONV_SRCMASK) == IRT_INT || /* Fold even across PHI to avoid expensive num->int conversions in loop. */
(fleft->op2 & IRCONV_SRCMASK) == IRT_U32) { if ((fleft->op2 & IRCONV_SRCMASK) == IRT_INT) {
/* Fold even across PHI to avoid expensive num->int conversions in loop. */
lua_assert(irt_isnum(fleft->t)); lua_assert(irt_isnum(fleft->t));
return fleft->op1; return fleft->op1;
} else if ((fleft->op2 & IRCONV_SRCMASK) == IRT_U32) {
lua_assert(irt_isnum(fleft->t));
fins->o = IR_CONV;
fins->op1 = fleft->op1;
fins->op2 = (IRT_INT<<5)|IRT_U32;
return RETRYFOLD;
} }
return NEXTFOLD; return NEXTFOLD;
} }