]> git.ipfire.org Git - thirdparty/LuaJIT.git/commitdiff
Fix FOLD rule for STRREF of SNEW.
authorMike Pall <mike>
Thu, 15 May 2014 15:03:28 +0000 (17:03 +0200)
committerMike Pall <mike>
Thu, 15 May 2014 15:03:28 +0000 (17:03 +0200)
src/lj_opt_fold.c

index 8a5b41cc223261ba102ec1444f758fd6690b223e..409549c9892fe5ab3405f16d3f0620be42f8b753 100644 (file)
@@ -505,13 +505,14 @@ LJFOLDF(kfold_strref_snew)
   } else {
     /* Reassociate: strref(snew(strref(str, a), len), b) ==> strref(str, a+b) */
     IRIns *ir = IR(fleft->op1);
-    IRRef1 str = ir->op1;  /* IRIns * is not valid across emitir. */
-    lua_assert(ir->o == IR_STRREF);
-    PHIBARRIER(ir);
-    fins->op2 = emitir(IRTI(IR_ADD), ir->op2, fins->op2);  /* Clobbers fins! */
-    fins->op1 = str;
-    fins->ot = IRT(IR_STRREF, IRT_P32);
-    return RETRYFOLD;
+    if (ir->o == IR_STRREF) {
+      IRRef1 str = ir->op1;  /* IRIns * is not valid across emitir. */
+      PHIBARRIER(ir);
+      fins->op2 = emitir(IRTI(IR_ADD), ir->op2, fins->op2); /* Clobbers fins! */
+      fins->op1 = str;
+      fins->ot = IRT(IR_STRREF, IRT_P32);
+      return RETRYFOLD;
+    }
   }
   return NEXTFOLD;
 }