mirror of
https://github.com/LuaJIT/LuaJIT.git
synced 2025-02-07 23:24:09 +00:00
Fix CONV.num.int sinking.
This commit is contained in:
parent
69906d15de
commit
ae1987d535
15
src/lj_asm.c
15
src/lj_asm.c
@ -826,10 +826,19 @@ static void asm_snap_alloc1(ASMState *as, IRRef ref)
|
|||||||
asm_snap_alloc1(as, (irs+1)->op2);
|
asm_snap_alloc1(as, (irs+1)->op2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (ir->o == IR_CONV && ir->op2 == IRCONV_NUM_INT) {
|
|
||||||
asm_snap_alloc1(as, ir->op1);
|
|
||||||
} else {
|
} else {
|
||||||
RegSet allow = (!LJ_SOFTFP && irt_isfp(ir->t)) ? RSET_FPR : RSET_GPR;
|
RegSet allow;
|
||||||
|
if (ir->o == IR_CONV && ir->op2 == IRCONV_NUM_INT) {
|
||||||
|
IRIns *irc;
|
||||||
|
for (irc = IR(as->curins); irc > ir; irc--)
|
||||||
|
if ((irc->op1 == ref || irc->op2 == ref) &&
|
||||||
|
!(irc->r == RID_SINK || irc->r == RID_SUNK))
|
||||||
|
goto nosink; /* Don't sink conversion if result is used. */
|
||||||
|
asm_snap_alloc1(as, ir->op1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
nosink:
|
||||||
|
allow = (!LJ_SOFTFP && irt_isfp(ir->t)) ? RSET_FPR : RSET_GPR;
|
||||||
if ((as->freeset & allow) ||
|
if ((as->freeset & allow) ||
|
||||||
(allow == RSET_FPR && asm_snap_canremat(as))) {
|
(allow == RSET_FPR && asm_snap_canremat(as))) {
|
||||||
/* Get a weak register if we have a free one or can rematerialize. */
|
/* Get a weak register if we have a free one or can rematerialize. */
|
||||||
|
Loading…
Reference in New Issue
Block a user