浏览代码

ARM64: Fix code generation for IR_SLOAD with typecheck + conversion.

Reported by memcorrupt.
Mike Pall 2 年之前
父节点
当前提交
564147f518
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      src/lj_asm_arm64.h

+ 1 - 1
src/lj_asm_arm64.h

@@ -1201,7 +1201,7 @@ dotypecheck:
       tmp = ra_scratch(as, allow);
       tmp = ra_scratch(as, allow);
       rset_clear(allow, tmp);
       rset_clear(allow, tmp);
     }
     }
-    if (ra_hasreg(dest) && irt_isnum(t) && !(ir->op2 & IRSLOAD_CONVERT))
+    if (ra_hasreg(dest) && tmp != dest)
       emit_dn(as, A64I_FMOV_D_R, (dest & 31), tmp);
       emit_dn(as, A64I_FMOV_D_R, (dest & 31), tmp);
     /* Need type check, even if the load result is unused. */
     /* Need type check, even if the load result is unused. */
     asm_guardcc(as, irt_isnum(t) ? CC_LS : CC_NE);
     asm_guardcc(as, irt_isnum(t) ? CC_LS : CC_NE);