aboutsummaryrefslogtreecommitdiff
path: root/src/lj_opt_fold.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lj_opt_fold.c')
-rw-r--r--src/lj_opt_fold.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/lj_opt_fold.c b/src/lj_opt_fold.c
index 92b9dfb4..adf88f4d 100644
--- a/src/lj_opt_fold.c
+++ b/src/lj_opt_fold.c
@@ -796,9 +796,9 @@ LJFOLDF(simplify_powi_kx)
796{ 796{
797 lua_Number n = knumleft; 797 lua_Number n = knumleft;
798 if (n == 2.0) { /* 2.0 ^ i ==> ldexp(1.0, tonum(i)) */ 798 if (n == 2.0) { /* 2.0 ^ i ==> ldexp(1.0, tonum(i)) */
799 fins->o = IR_TONUM; 799 fins->o = IR_CONV;
800 fins->op1 = fins->op2; 800 fins->op1 = fins->op2;
801 fins->op2 = 0; 801 fins->op2 = IRCONV_NUM_INT;
802 fins->op2 = (IRRef1)lj_opt_fold(J); 802 fins->op2 = (IRRef1)lj_opt_fold(J);
803 fins->op1 = (IRRef1)lj_ir_knum_one(J); 803 fins->op1 = (IRRef1)lj_ir_knum_one(J);
804 fins->o = IR_LDEXP; 804 fins->o = IR_LDEXP;
@@ -953,18 +953,19 @@ LJFOLDF(cse_conv)
953} 953}
954 954
955/* FP conversion narrowing. */ 955/* FP conversion narrowing. */
956LJFOLD(TOINT ADD any)
957LJFOLD(TOINT SUB any)
958LJFOLD(TOBIT ADD KNUM) 956LJFOLD(TOBIT ADD KNUM)
959LJFOLD(TOBIT SUB KNUM) 957LJFOLD(TOBIT SUB KNUM)
960LJFOLD(TOI64 ADD 5) /* IRTOINT_TRUNCI64 */ 958LJFOLD(CONV ADD IRCONV_INT_NUM)
961LJFOLD(TOI64 SUB 5) /* IRTOINT_TRUNCI64 */ 959LJFOLD(CONV SUB IRCONV_INT_NUM)
960LJFOLD(CONV ADD IRCONV_I64_NUM)
961LJFOLD(CONV SUB IRCONV_I64_NUM)
962LJFOLDF(narrow_convert) 962LJFOLDF(narrow_convert)
963{ 963{
964 PHIBARRIER(fleft); 964 PHIBARRIER(fleft);
965 /* Narrowing ignores PHIs and repeating it inside the loop is not useful. */ 965 /* Narrowing ignores PHIs and repeating it inside the loop is not useful. */
966 if (J->chain[IR_LOOP]) 966 if (J->chain[IR_LOOP])
967 return NEXTFOLD; 967 return NEXTFOLD;
968 lua_assert(fins->o != IR_CONV || (fins->op2&IRCONV_CONVMASK) != IRCONV_TOBIT);
968 return lj_opt_narrow_convert(J); 969 return lj_opt_narrow_convert(J);
969} 970}
970 971