diff options
| author | Mike Pall <mike> | 2022-01-13 14:40:11 +0100 |
|---|---|---|
| committer | Mike Pall <mike> | 2022-01-13 14:40:11 +0100 |
| commit | c8bcf1e5fb8eb72c7e35604fdfd27bba512761bb (patch) | |
| tree | d1ac59f1ed86bfceee69058ba554c410e65a8975 | |
| parent | e73916d811710ab02a4dfe447d621c99f4e7186c (diff) | |
| download | luajit-c8bcf1e5fb8eb72c7e35604fdfd27bba512761bb.tar.gz luajit-c8bcf1e5fb8eb72c7e35604fdfd27bba512761bb.tar.bz2 luajit-c8bcf1e5fb8eb72c7e35604fdfd27bba512761bb.zip | |
Fix ABC FOLD rule with constants.
Reported by XmiliaH.
| -rw-r--r-- | src/lj_opt_fold.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/lj_opt_fold.c b/src/lj_opt_fold.c index 6bb3fc59..1723af60 100644 --- a/src/lj_opt_fold.c +++ b/src/lj_opt_fold.c | |||
| @@ -1682,14 +1682,15 @@ LJFOLDF(abc_fwd) | |||
| 1682 | LJFOLD(ABC any KINT) | 1682 | LJFOLD(ABC any KINT) |
| 1683 | LJFOLDF(abc_k) | 1683 | LJFOLDF(abc_k) |
| 1684 | { | 1684 | { |
| 1685 | PHIBARRIER(fleft); | ||
| 1685 | if (LJ_LIKELY(J->flags & JIT_F_OPT_ABC)) { | 1686 | if (LJ_LIKELY(J->flags & JIT_F_OPT_ABC)) { |
| 1686 | IRRef ref = J->chain[IR_ABC]; | 1687 | IRRef ref = J->chain[IR_ABC]; |
| 1687 | IRRef asize = fins->op1; | 1688 | IRRef asize = fins->op1; |
| 1688 | while (ref > asize) { | 1689 | while (ref > asize) { |
| 1689 | IRIns *ir = IR(ref); | 1690 | IRIns *ir = IR(ref); |
| 1690 | if (ir->op1 == asize && irref_isk(ir->op2)) { | 1691 | if (ir->op1 == asize && irref_isk(ir->op2)) { |
| 1691 | int32_t k = IR(ir->op2)->i; | 1692 | uint32_t k = (uint32_t)IR(ir->op2)->i; |
| 1692 | if (fright->i > k) | 1693 | if ((uint32_t)fright->i > k) |
| 1693 | ir->op2 = fins->op2; | 1694 | ir->op2 = fins->op2; |
| 1694 | return DROPFOLD; | 1695 | return DROPFOLD; |
| 1695 | } | 1696 | } |
