]> git.ipfire.org Git - thirdparty/LuaJIT.git/commitdiff
Fix narrowing of TOBIT.
authorMike Pall <mike>
Wed, 10 Jun 2015 14:14:41 +0000 (16:14 +0200)
committerMike Pall <mike>
Wed, 10 Jun 2015 14:14:41 +0000 (16:14 +0200)
src/lj_opt_narrow.c

index 58b3763dba5af3d7657e046b0cd73a6a44ae3514..fb647189b5008ad821ca3905d5874f751b89d37b 100644 (file)
@@ -205,7 +205,6 @@ typedef struct NarrowConv {
   jit_State *J;                /* JIT compiler state. */
   NarrowIns *sp;       /* Current stack pointer. */
   NarrowIns *maxsp;    /* Maximum stack pointer minus redzone. */
-  int lim;             /* Limit on the number of emitted conversions. */
   IRRef mode;          /* Conversion mode (IRCONV_*). */
   IRType t;            /* Destination type: IRT_INT or IRT_I64. */
   NarrowIns stack[NARROW_MAX_STACK];  /* Stack holding stack-machine code. */
@@ -342,7 +341,7 @@ static int narrow_conv_backprop(NarrowConv *nc, IRRef ref, int depth)
       NarrowIns *savesp = nc->sp;
       int count = narrow_conv_backprop(nc, ir->op1, depth);
       count += narrow_conv_backprop(nc, ir->op2, depth);
-      if (count <= nc->lim) {  /* Limit total number of conversions. */
+      if (count <= 1) {  /* Limit total number of conversions. */
        *nc->sp++ = NARROWINS(IRT(ir->o, nc->t), ref);
        return count;
       }
@@ -414,12 +413,10 @@ TRef LJ_FASTCALL lj_opt_narrow_convert(jit_State *J)
     nc.t = irt_type(fins->t);
     if (fins->o == IR_TOBIT) {
       nc.mode = IRCONV_TOBIT;  /* Used only in the backpropagation cache. */
-      nc.lim = 2;  /* TOBIT can use a more optimistic rule. */
     } else {
       nc.mode = fins->op2;
-      nc.lim = 1;
     }
-    if (narrow_conv_backprop(&nc, fins->op1, 0) <= nc.lim)
+    if (narrow_conv_backprop(&nc, fins->op1, 0) <= 1)
       return narrow_conv_emit(J, &nc);
   }
   return NEXTFOLD;