Fix ABC FOLD rule with constants.

Reported by XmiliaH.
master
Mike Pall 2022-01-13 14:40:11 +01:00
parent e73916d811
commit c8bcf1e5fb
1 changed files with 3 additions and 2 deletions

View File

@ -1682,14 +1682,15 @@ LJFOLDF(abc_fwd)
LJFOLD(ABC any KINT)
LJFOLDF(abc_k)
{
PHIBARRIER(fleft);
if (LJ_LIKELY(J->flags & JIT_F_OPT_ABC)) {
IRRef ref = J->chain[IR_ABC];
IRRef asize = fins->op1;
while (ref > asize) {
IRIns *ir = IR(ref);
if (ir->op1 == asize && irref_isk(ir->op2)) {
int32_t k = IR(ir->op2)->i;
if (fright->i > k)
uint32_t k = (uint32_t)IR(ir->op2)->i;
if ((uint32_t)fright->i > k)
ir->op2 = fins->op2;
return DROPFOLD;
}