aboutsummaryrefslogtreecommitdiff
path: root/src/lj_opt_mem.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lj_opt_mem.c')
-rw-r--r--src/lj_opt_mem.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/lj_opt_mem.c b/src/lj_opt_mem.c
index c8cdc3e5..400fb48e 100644
--- a/src/lj_opt_mem.c
+++ b/src/lj_opt_mem.c
@@ -17,6 +17,7 @@
17#include "lj_ir.h" 17#include "lj_ir.h"
18#include "lj_jit.h" 18#include "lj_jit.h"
19#include "lj_iropt.h" 19#include "lj_iropt.h"
20#include "lj_ircall.h"
20 21
21/* Some local macros to save typing. Undef'd at the end. */ 22/* Some local macros to save typing. Undef'd at the end. */
22#define IR(ref) (&J->cur.ir[(ref)]) 23#define IR(ref) (&J->cur.ir[(ref)])
@@ -308,7 +309,7 @@ int LJ_FASTCALL lj_opt_fwd_href_nokey(jit_State *J)
308 return 1; /* No conflict. Can fold to niltv. */ 309 return 1; /* No conflict. Can fold to niltv. */
309} 310}
310 311
311/* Check whether there's no aliasing NEWREF for the left operand. */ 312/* Check whether there's no aliasing NEWREF/table.clear for the left operand. */
312int LJ_FASTCALL lj_opt_fwd_tptr(jit_State *J, IRRef lim) 313int LJ_FASTCALL lj_opt_fwd_tptr(jit_State *J, IRRef lim)
313{ 314{
314 IRRef ta = fins->op1; 315 IRRef ta = fins->op1;
@@ -319,6 +320,14 @@ int LJ_FASTCALL lj_opt_fwd_tptr(jit_State *J, IRRef lim)
319 return 0; /* Conflict. */ 320 return 0; /* Conflict. */
320 ref = newref->prev; 321 ref = newref->prev;
321 } 322 }
323 ref = J->chain[IR_CALLS];
324 while (ref > lim) {
325 IRIns *calls = IR(ref);
326 if (calls->op2 == IRCALL_lj_tab_clear &&
327 (ta == calls->op1 || aa_table(J, ta, calls->op1) != ALIAS_NO))
328 return 0; /* Conflict. */
329 ref = calls->prev;
330 }
322 return 1; /* No conflict. Can safely FOLD/CSE. */ 331 return 1; /* No conflict. Can safely FOLD/CSE. */
323} 332}
324 333