aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lj_asm.c2
-rw-r--r--src/lj_ir.h8
-rw-r--r--src/lj_opt_dce.c5
-rw-r--r--src/lj_opt_mem.c25
4 files changed, 15 insertions, 25 deletions
diff --git a/src/lj_asm.c b/src/lj_asm.c
index cc7841c0..aae7b5b9 100644
--- a/src/lj_asm.c
+++ b/src/lj_asm.c
@@ -2342,7 +2342,7 @@ void lj_asm_trace(jit_State *J, GCtrace *T)
2342 /* Ensure an initialized instruction beyond the last one for HIOP checks. */ 2342 /* Ensure an initialized instruction beyond the last one for HIOP checks. */
2343 /* This also allows one RENAME to be added without reallocating curfinal. */ 2343 /* This also allows one RENAME to be added without reallocating curfinal. */
2344 as->orignins = lj_ir_nextins(J); 2344 as->orignins = lj_ir_nextins(J);
2345 J->cur.ir[as->orignins].o = IR_NOP; 2345 lj_ir_nop(&J->cur.ir[as->orignins]);
2346 2346
2347 /* Setup initial state. Copy some fields to reduce indirections. */ 2347 /* Setup initial state. Copy some fields to reduce indirections. */
2348 as->J = J; 2348 as->J = J;
diff --git a/src/lj_ir.h b/src/lj_ir.h
index b9da1fc5..0340f3c2 100644
--- a/src/lj_ir.h
+++ b/src/lj_ir.h
@@ -587,4 +587,12 @@ static LJ_AINLINE int ir_sideeff(IRIns *ir)
587 587
588LJ_STATIC_ASSERT((int)IRT_GUARD == (int)IRM_W); 588LJ_STATIC_ASSERT((int)IRT_GUARD == (int)IRM_W);
589 589
590/* Replace IR instruction with NOP. */
591static LJ_AINLINE void lj_ir_nop(IRIns *ir)
592{
593 ir->ot = IRT(IR_NOP, IRT_NIL);
594 ir->op1 = ir->op2 = 0;
595 ir->prev = 0;
596}
597
590#endif 598#endif
diff --git a/src/lj_opt_dce.c b/src/lj_opt_dce.c
index a1df91dd..31e5badd 100644
--- a/src/lj_opt_dce.c
+++ b/src/lj_opt_dce.c
@@ -47,10 +47,7 @@ static void dce_propagate(jit_State *J)
47 pchain[ir->o] = &ir->prev; 47 pchain[ir->o] = &ir->prev;
48 } else if (!ir_sideeff(ir)) { 48 } else if (!ir_sideeff(ir)) {
49 *pchain[ir->o] = ir->prev; /* Reroute original instruction chain. */ 49 *pchain[ir->o] = ir->prev; /* Reroute original instruction chain. */
50 ir->t.irt = IRT_NIL; 50 lj_ir_nop(ir);
51 ir->o = IR_NOP; /* Replace instruction with NOP. */
52 ir->op1 = ir->op2 = 0;
53 ir->prev = 0;
54 continue; 51 continue;
55 } 52 }
56 if (ir->op1 >= REF_FIRST) irt_setmark(IR(ir->op1)->t); 53 if (ir->op1 >= REF_FIRST) irt_setmark(IR(ir->op1)->t);
diff --git a/src/lj_opt_mem.c b/src/lj_opt_mem.c
index 80517f16..0d9837b1 100644
--- a/src/lj_opt_mem.c
+++ b/src/lj_opt_mem.c
@@ -370,10 +370,7 @@ TRef LJ_FASTCALL lj_opt_dse_ahstore(jit_State *J)
370 goto doemit; /* No elimination possible. */ 370 goto doemit; /* No elimination possible. */
371 /* Remove redundant store from chain and replace with NOP. */ 371 /* Remove redundant store from chain and replace with NOP. */
372 *refp = store->prev; 372 *refp = store->prev;
373 store->o = IR_NOP; 373 lj_ir_nop(store);
374 store->t.irt = IRT_NIL;
375 store->op1 = store->op2 = 0;
376 store->prev = 0;
377 /* Now emit the new store instead. */ 374 /* Now emit the new store instead. */
378 } 375 }
379 goto doemit; 376 goto doemit;
@@ -534,10 +531,7 @@ TRef LJ_FASTCALL lj_opt_dse_ustore(jit_State *J)
534 goto doemit; /* No elimination possible. */ 531 goto doemit; /* No elimination possible. */
535 /* Remove redundant store from chain and replace with NOP. */ 532 /* Remove redundant store from chain and replace with NOP. */
536 *refp = store->prev; 533 *refp = store->prev;
537 store->o = IR_NOP; 534 lj_ir_nop(store);
538 store->t.irt = IRT_NIL;
539 store->op1 = store->op2 = 0;
540 store->prev = 0;
541 if (ref+1 < J->cur.nins && 535 if (ref+1 < J->cur.nins &&
542 store[1].o == IR_OBAR && store[1].op1 == xref) { 536 store[1].o == IR_OBAR && store[1].op1 == xref) {
543 IRRef1 *bp = &J->chain[IR_OBAR]; 537 IRRef1 *bp = &J->chain[IR_OBAR];
@@ -546,10 +540,7 @@ TRef LJ_FASTCALL lj_opt_dse_ustore(jit_State *J)
546 bp = &obar->prev; 540 bp = &obar->prev;
547 /* Remove OBAR, too. */ 541 /* Remove OBAR, too. */
548 *bp = obar->prev; 542 *bp = obar->prev;
549 obar->o = IR_NOP; 543 lj_ir_nop(obar);
550 obar->t.irt = IRT_NIL;
551 obar->op1 = obar->op2 = 0;
552 obar->prev = 0;
553 } 544 }
554 /* Now emit the new store instead. */ 545 /* Now emit the new store instead. */
555 } 546 }
@@ -640,10 +631,7 @@ TRef LJ_FASTCALL lj_opt_dse_fstore(jit_State *J)
640 goto doemit; /* No elimination possible. */ 631 goto doemit; /* No elimination possible. */
641 /* Remove redundant store from chain and replace with NOP. */ 632 /* Remove redundant store from chain and replace with NOP. */
642 *refp = store->prev; 633 *refp = store->prev;
643 store->o = IR_NOP; 634 lj_ir_nop(store);
644 store->t.irt = IRT_NIL;
645 store->op1 = store->op2 = 0;
646 store->prev = 0;
647 /* Now emit the new store instead. */ 635 /* Now emit the new store instead. */
648 } 636 }
649 goto doemit; 637 goto doemit;
@@ -894,10 +882,7 @@ TRef LJ_FASTCALL lj_opt_dse_xstore(jit_State *J)
894 goto doemit; /* No elimination possible. */ 882 goto doemit; /* No elimination possible. */
895 /* Remove redundant store from chain and replace with NOP. */ 883 /* Remove redundant store from chain and replace with NOP. */
896 *refp = store->prev; 884 *refp = store->prev;
897 store->o = IR_NOP; 885 lj_ir_nop(store);
898 store->t.irt = IRT_NIL;
899 store->op1 = store->op2 = 0;
900 store->prev = 0;
901 /* Now emit the new store instead. */ 886 /* Now emit the new store instead. */
902 } 887 }
903 goto doemit; 888 goto doemit;