mirror of
https://github.com/LuaJIT/LuaJIT.git
synced 2025-02-07 23:24:09 +00:00
Fix conflict between loop branch inversion and HREF+NE/EQ merging.
This commit is contained in:
parent
188f0b04e1
commit
fe21a42a92
12
src/lj_asm.c
12
src/lj_asm.c
@ -1614,11 +1614,13 @@ static MCode *merge_href_niltv(ASMState *as, IRIns *ir)
|
|||||||
/* Assumes nothing else generates NE of HREF. */
|
/* Assumes nothing else generates NE of HREF. */
|
||||||
if ((ir[1].o == IR_NE || ir[1].o == IR_EQ) && ir[1].op1 == as->curins &&
|
if ((ir[1].o == IR_NE || ir[1].o == IR_EQ) && ir[1].op1 == as->curins &&
|
||||||
ra_hasreg(ir->r)) {
|
ra_hasreg(ir->r)) {
|
||||||
if (LJ_64 && *as->mcp != XI_ARITHi)
|
MCode *p = as->mcp;
|
||||||
as->mcp += 7+6;
|
p += (LJ_64 && *p != XI_ARITHi) ? 7+6 : 6+6;
|
||||||
else
|
/* Ensure no loop branch inversion happened. */
|
||||||
as->mcp += 6+6; /* Kill cmp reg, imm32 + jz exit. */
|
if (p[-6] == 0x0f && p[-5] == XI_JCCn+(CC_NE^(ir[1].o & 1))) {
|
||||||
return as->mcp + *(int32_t *)(as->mcp-4); /* Return exit address. */
|
as->mcp = p; /* Kill cmp reg, imm32 + jz exit. */
|
||||||
|
return p + *(int32_t *)(p-4); /* Return exit address. */
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user