aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lj_opt_narrow.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/lj_opt_narrow.c b/src/lj_opt_narrow.c
index 58b3763d..fb647189 100644
--- a/src/lj_opt_narrow.c
+++ b/src/lj_opt_narrow.c
@@ -205,7 +205,6 @@ typedef struct NarrowConv {
205 jit_State *J; /* JIT compiler state. */ 205 jit_State *J; /* JIT compiler state. */
206 NarrowIns *sp; /* Current stack pointer. */ 206 NarrowIns *sp; /* Current stack pointer. */
207 NarrowIns *maxsp; /* Maximum stack pointer minus redzone. */ 207 NarrowIns *maxsp; /* Maximum stack pointer minus redzone. */
208 int lim; /* Limit on the number of emitted conversions. */
209 IRRef mode; /* Conversion mode (IRCONV_*). */ 208 IRRef mode; /* Conversion mode (IRCONV_*). */
210 IRType t; /* Destination type: IRT_INT or IRT_I64. */ 209 IRType t; /* Destination type: IRT_INT or IRT_I64. */
211 NarrowIns stack[NARROW_MAX_STACK]; /* Stack holding stack-machine code. */ 210 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)
342 NarrowIns *savesp = nc->sp; 341 NarrowIns *savesp = nc->sp;
343 int count = narrow_conv_backprop(nc, ir->op1, depth); 342 int count = narrow_conv_backprop(nc, ir->op1, depth);
344 count += narrow_conv_backprop(nc, ir->op2, depth); 343 count += narrow_conv_backprop(nc, ir->op2, depth);
345 if (count <= nc->lim) { /* Limit total number of conversions. */ 344 if (count <= 1) { /* Limit total number of conversions. */
346 *nc->sp++ = NARROWINS(IRT(ir->o, nc->t), ref); 345 *nc->sp++ = NARROWINS(IRT(ir->o, nc->t), ref);
347 return count; 346 return count;
348 } 347 }
@@ -414,12 +413,10 @@ TRef LJ_FASTCALL lj_opt_narrow_convert(jit_State *J)
414 nc.t = irt_type(fins->t); 413 nc.t = irt_type(fins->t);
415 if (fins->o == IR_TOBIT) { 414 if (fins->o == IR_TOBIT) {
416 nc.mode = IRCONV_TOBIT; /* Used only in the backpropagation cache. */ 415 nc.mode = IRCONV_TOBIT; /* Used only in the backpropagation cache. */
417 nc.lim = 2; /* TOBIT can use a more optimistic rule. */
418 } else { 416 } else {
419 nc.mode = fins->op2; 417 nc.mode = fins->op2;
420 nc.lim = 1;
421 } 418 }
422 if (narrow_conv_backprop(&nc, fins->op1, 0) <= nc.lim) 419 if (narrow_conv_backprop(&nc, fins->op1, 0) <= 1)
423 return narrow_conv_emit(J, &nc); 420 return narrow_conv_emit(J, &nc);
424 } 421 }
425 return NEXTFOLD; 422 return NEXTFOLD;