aboutsummaryrefslogtreecommitdiff
path: root/src/lj_opt_loop.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/lj_opt_loop.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/lj_opt_loop.c b/src/lj_opt_loop.c
index 05e9409e..f9a2a808 100644
--- a/src/lj_opt_loop.c
+++ b/src/lj_opt_loop.c
@@ -131,15 +131,18 @@ static void loop_emit_phi(jit_State *J, IRRef1 *subst, IRRef1 *phi, IRRef nphi)
131 nslots = J->baseslot+J->maxslot; 131 nslots = J->baseslot+J->maxslot;
132 for (i = 1; i < nslots; i++) { 132 for (i = 1; i < nslots; i++) {
133 IRRef ref = tref_ref(J->slot[i]); 133 IRRef ref = tref_ref(J->slot[i]);
134 if (!irref_isk(ref) && ref != subst[ref]) { 134 while (!irref_isk(ref) && ref != subst[ref]) {
135 IRIns *ir = IR(ref); 135 IRIns *ir = IR(ref);
136 irt_clearmark(ir->t); /* Unmark potential uses, too. */ 136 irt_clearmark(ir->t); /* Unmark potential uses, too. */
137 if (!irt_isphi(ir->t) && !irt_ispri(ir->t)) { 137 if (irt_isphi(ir->t) || irt_ispri(ir->t))
138 irt_setphi(ir->t); 138 break;
139 if (nphi >= LJ_MAX_PHI) 139 irt_setphi(ir->t);
140 lj_trace_err(J, LJ_TRERR_PHIOV); 140 if (nphi >= LJ_MAX_PHI)
141 phi[nphi++] = (IRRef1)ref; 141 lj_trace_err(J, LJ_TRERR_PHIOV);
142 } 142 phi[nphi++] = (IRRef1)ref;
143 ref = subst[ref];
144 if (ref > invar)
145 break;
143 } 146 }
144 } 147 }
145 /* Pass #4: emit PHI instructions or eliminate PHIs. */ 148 /* Pass #4: emit PHI instructions or eliminate PHIs. */