summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Pall <mike>2013-06-18 20:08:55 +0200
committerMike Pall <mike>2013-06-18 20:08:55 +0200
commit9211a66e0e2bcbcaffc4a8c76bfc2a39bce6f0e5 (patch)
tree23740d668a995d9280389e00fd0914dafbbb929c
parent21af151af28d4b3524684b106bd19b02484f67f1 (diff)
downloadluajit-9211a66e0e2bcbcaffc4a8c76bfc2a39bce6f0e5.tar.gz
luajit-9211a66e0e2bcbcaffc4a8c76bfc2a39bce6f0e5.tar.bz2
luajit-9211a66e0e2bcbcaffc4a8c76bfc2a39bce6f0e5.zip
Improve ULOAD forwarding for open upvalues.
-rw-r--r--src/lj_opt_mem.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/lj_opt_mem.c b/src/lj_opt_mem.c
index 98974ce3..0fd17306 100644
--- a/src/lj_opt_mem.c
+++ b/src/lj_opt_mem.c
@@ -396,13 +396,13 @@ static AliasRet aa_uref(IRIns *refa, IRIns *refb)
396TRef LJ_FASTCALL lj_opt_fwd_uload(jit_State *J) 396TRef LJ_FASTCALL lj_opt_fwd_uload(jit_State *J)
397{ 397{
398 IRRef uref = fins->op1; 398 IRRef uref = fins->op1;
399 IRRef lim = uref; /* Search limit. */ 399 IRRef lim = REF_BASE; /* Search limit. */
400 IRIns *xr = IR(uref); 400 IRIns *xr = IR(uref);
401 IRRef ref; 401 IRRef ref;
402 402
403 /* Search for conflicting stores. */ 403 /* Search for conflicting stores. */
404 ref = J->chain[IR_USTORE]; 404 ref = J->chain[IR_USTORE];
405 while (ref > uref) { 405 while (ref > lim) {
406 IRIns *store = IR(ref); 406 IRIns *store = IR(ref);
407 switch (aa_uref(xr, IR(store->op1))) { 407 switch (aa_uref(xr, IR(store->op1))) {
408 case ALIAS_NO: break; /* Continue searching. */ 408 case ALIAS_NO: break; /* Continue searching. */
@@ -414,7 +414,16 @@ TRef LJ_FASTCALL lj_opt_fwd_uload(jit_State *J)
414 414
415cselim: 415cselim:
416 /* Try to find a matching load. Below the conflicting store, if any. */ 416 /* Try to find a matching load. Below the conflicting store, if any. */
417 return lj_opt_cselim(J, lim); 417
418 ref = J->chain[IR_ULOAD];
419 while (ref > lim) {
420 IRIns *ir = IR(ref);
421 if (ir->op1 == uref ||
422 (IR(ir->op1)->op12 == IR(uref)->op12 && IR(ir->op1)->o == IR(uref)->o))
423 return ref; /* Match for identical or equal UREFx (non-CSEable UREFO). */
424 ref = ir->prev;
425 }
426 return lj_ir_emit(J);
418} 427}
419 428
420/* USTORE elimination. */ 429/* USTORE elimination. */