mirror of
https://github.com/LuaJIT/LuaJIT.git
synced 2025-02-07 23:24:09 +00:00
Fix fused constant loads under high register pressure.
This commit is contained in:
parent
4846a714a9
commit
6d0654d3ec
@ -353,6 +353,7 @@ static Reg ra_rematk(ASMState *as, IRRef ref)
|
|||||||
static int32_t ra_spill(ASMState *as, IRIns *ir)
|
static int32_t ra_spill(ASMState *as, IRIns *ir)
|
||||||
{
|
{
|
||||||
int32_t slot = ir->s;
|
int32_t slot = ir->s;
|
||||||
|
lua_assert(ir >= as->ir + REF_TRUE);
|
||||||
if (!ra_hasspill(slot)) {
|
if (!ra_hasspill(slot)) {
|
||||||
if (irt_is64(ir->t)) {
|
if (irt_is64(ir->t)) {
|
||||||
slot = as->evenspill;
|
slot = as->evenspill;
|
||||||
|
@ -325,6 +325,14 @@ static Reg asm_fuseload(ASMState *as, IRRef ref, RegSet allow)
|
|||||||
as->mrm.base = as->mrm.idx = RID_NONE;
|
as->mrm.base = as->mrm.idx = RID_NONE;
|
||||||
return RID_MRM;
|
return RID_MRM;
|
||||||
}
|
}
|
||||||
|
} else if (ir->o == IR_KINT64) {
|
||||||
|
RegSet avail = as->freeset & ~as->modset & RSET_GPR;
|
||||||
|
lua_assert(allow != RSET_EMPTY);
|
||||||
|
if (!(avail & (avail-1))) { /* Fuse if less than two regs available. */
|
||||||
|
as->mrm.ofs = ptr2addr(ir_kint64(ir));
|
||||||
|
as->mrm.base = as->mrm.idx = RID_NONE;
|
||||||
|
return RID_MRM;
|
||||||
|
}
|
||||||
} else if (mayfuse(as, ref)) {
|
} else if (mayfuse(as, ref)) {
|
||||||
RegSet xallow = (allow & RSET_GPR) ? allow : RSET_GPR;
|
RegSet xallow = (allow & RSET_GPR) ? allow : RSET_GPR;
|
||||||
if (ir->o == IR_SLOAD) {
|
if (ir->o == IR_SLOAD) {
|
||||||
@ -361,7 +369,7 @@ static Reg asm_fuseload(ASMState *as, IRRef ref, RegSet allow)
|
|||||||
return RID_MRM;
|
return RID_MRM;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!(as->freeset & allow) &&
|
if (!(as->freeset & allow) && !irref_isk(ref) &&
|
||||||
(allow == RSET_EMPTY || ra_hasspill(ir->s) || iscrossref(as, ref)))
|
(allow == RSET_EMPTY || ra_hasspill(ir->s) || iscrossref(as, ref)))
|
||||||
goto fusespill;
|
goto fusespill;
|
||||||
return ra_allocref(as, ref, allow);
|
return ra_allocref(as, ref, allow);
|
||||||
|
Loading…
Reference in New Issue
Block a user