mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2025-06-12 08:09:30 +00:00
Fix sanitizer check issue when both def reg and ref reg are the same (#1226)
Fix issue of instruction like MOV i3, i3
This commit is contained in:
parent
96fa546cc9
commit
5340e3c3de
|
@ -358,19 +358,33 @@ is_alloc_candidate(JitCompContext *cc, JitReg reg)
|
||||||
static void
|
static void
|
||||||
check_vreg_definition(RegallocContext *rc, JitInsn *insn)
|
check_vreg_definition(RegallocContext *rc, JitInsn *insn)
|
||||||
{
|
{
|
||||||
unsigned j;
|
|
||||||
JitRegVec regvec = jit_insn_opnd_regs(insn);
|
JitRegVec regvec = jit_insn_opnd_regs(insn);
|
||||||
unsigned first_use = jit_insn_opnd_first_use(insn);
|
unsigned i;
|
||||||
JitReg *regp;
|
JitReg *regp;
|
||||||
|
unsigned first_use = jit_insn_opnd_first_use(insn);
|
||||||
|
JitReg reg_defined;
|
||||||
|
|
||||||
/* check if there is the definition of an vr before its references */
|
/* check if there is the definition of an vr before its references */
|
||||||
JIT_REG_VEC_FOREACH_USE(regvec, j, regp, first_use)
|
JIT_REG_VEC_FOREACH(regvec, i, regp)
|
||||||
{
|
{
|
||||||
VirtualReg *vr = NULL;
|
VirtualReg *vr = NULL;
|
||||||
|
|
||||||
if (!is_alloc_candidate(rc->cc, *regp))
|
if (!is_alloc_candidate(rc->cc, *regp))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
/*a strong assumption that there is only on defined reg*/
|
||||||
|
if (i < first_use) {
|
||||||
|
reg_defined = *regp;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* both definition and references are in one instruction,
|
||||||
|
* like MOV i3,i3
|
||||||
|
**/
|
||||||
|
if (reg_defined == *regp)
|
||||||
|
continue;
|
||||||
|
|
||||||
vr = rc_get_vr(rc, *regp);
|
vr = rc_get_vr(rc, *regp);
|
||||||
bh_assert(vr->distances);
|
bh_assert(vr->distances);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user