Add table.clear().
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
#include "lj_ir.h"
|
||||
#include "lj_jit.h"
|
||||
#include "lj_iropt.h"
|
||||
#include "lj_ircall.h"
|
||||
|
||||
/* Some local macros to save typing. Undef'd at the end. */
|
||||
#define IR(ref) (&J->cur.ir[(ref)])
|
||||
@@ -308,7 +309,7 @@ int LJ_FASTCALL lj_opt_fwd_href_nokey(jit_State *J)
|
||||
return 1; /* No conflict. Can fold to niltv. */
|
||||
}
|
||||
|
||||
/* Check whether there's no aliasing NEWREF for the left operand. */
|
||||
/* Check whether there's no aliasing NEWREF/table.clear for the left operand. */
|
||||
int LJ_FASTCALL lj_opt_fwd_tptr(jit_State *J, IRRef lim)
|
||||
{
|
||||
IRRef ta = fins->op1;
|
||||
@@ -319,6 +320,14 @@ int LJ_FASTCALL lj_opt_fwd_tptr(jit_State *J, IRRef lim)
|
||||
return 0; /* Conflict. */
|
||||
ref = newref->prev;
|
||||
}
|
||||
ref = J->chain[IR_CALLS];
|
||||
while (ref > lim) {
|
||||
IRIns *calls = IR(ref);
|
||||
if (calls->op2 == IRCALL_lj_tab_clear &&
|
||||
(ta == calls->op1 || aa_table(J, ta, calls->op1) != ALIAS_NO))
|
||||
return 0; /* Conflict. */
|
||||
ref = calls->prev;
|
||||
}
|
||||
return 1; /* No conflict. Can safely FOLD/CSE. */
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user