Fix FOLD of string concatenations.

This commit is contained in:
Mike Pall 2014-04-15 19:56:23 +02:00
parent 27c453e8e8
commit 43dc06bac1

View File

@ -585,7 +585,8 @@ LJFOLDF(bufstr_kfold_cse)
if (fleft->o == IR_BUFHDR) { /* No put operations? */ if (fleft->o == IR_BUFHDR) { /* No put operations? */
if (!(fleft->op2 & IRBUFHDR_APPEND)) /* Empty buffer? */ if (!(fleft->op2 & IRBUFHDR_APPEND)) /* Empty buffer? */
return lj_ir_kstr(J, &J2G(J)->strempty); return lj_ir_kstr(J, &J2G(J)->strempty);
fins->op1 = fleft->prev; /* Relies on checks in bufput_append. */ fins->op1 = fleft->op1;
fins->op2 = fleft->prev; /* Relies on checks in bufput_append. */
return CSEFOLD; return CSEFOLD;
} else if (fleft->o == IR_BUFPUT) { } else if (fleft->o == IR_BUFPUT) {
IRIns *irb = IR(fleft->op1); IRIns *irb = IR(fleft->op1);