diff options
author | Mike Pall <mike> | 2011-11-14 23:57:05 +0100 |
---|---|---|
committer | Mike Pall <mike> | 2011-11-14 23:57:05 +0100 |
commit | 8437d0c48d52267f826361cd7f38711bdc02e489 (patch) | |
tree | 1a351ef459b6b568cb753b4f3b1f4294d88a9d30 /src | |
parent | 87456f73f5887ce9c54ce0ca5cc19c3544309af4 (diff) | |
download | luajit-8437d0c48d52267f826361cd7f38711bdc02e489.tar.gz luajit-8437d0c48d52267f826361cd7f38711bdc02e489.tar.bz2 luajit-8437d0c48d52267f826361cd7f38711bdc02e489.zip |
Eliminate some rare occurrences of redundant PHIs.
Diffstat (limited to 'src')
-rw-r--r-- | src/lj_opt_loop.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/lj_opt_loop.c b/src/lj_opt_loop.c index 0e03205f..d1512468 100644 --- a/src/lj_opt_loop.c +++ b/src/lj_opt_loop.c | |||
@@ -159,11 +159,15 @@ static void loop_emit_phi(jit_State *J, IRRef1 *subst, IRRef1 *phi, IRRef nphi, | |||
159 | for (i = 0; i < nphi; i++) { | 159 | for (i = 0; i < nphi; i++) { |
160 | IRRef lref = phi[i]; | 160 | IRRef lref = phi[i]; |
161 | IRIns *ir = IR(lref); | 161 | IRIns *ir = IR(lref); |
162 | if (!irt_ismarked(ir->t)) { /* Emit PHI if not marked. */ | 162 | if (!irt_ismarked(ir->t)) { /* Emit PHI if not marked and not redundant. */ |
163 | IRRef rref = subst[lref]; | 163 | IRRef rref = subst[lref]; |
164 | if (rref > invar) | 164 | if (lref == rref) { |
165 | irt_setphi(IR(rref)->t); | 165 | irt_clearphi(ir->t); |
166 | emitir_raw(IRT(IR_PHI, irt_type(ir->t)), lref, rref); | 166 | } else { |
167 | if (rref > invar) | ||
168 | irt_setphi(IR(rref)->t); | ||
169 | emitir_raw(IRT(IR_PHI, irt_type(ir->t)), lref, rref); | ||
170 | } | ||
167 | } else { /* Otherwise eliminate PHI. */ | 171 | } else { /* Otherwise eliminate PHI. */ |
168 | irt_clearmark(ir->t); | 172 | irt_clearmark(ir->t); |
169 | irt_clearphi(ir->t); | 173 | irt_clearphi(ir->t); |