diff options
| author | Mike Pall <mike> | 2011-08-17 20:42:41 +0200 |
|---|---|---|
| committer | Mike Pall <mike> | 2011-08-17 20:42:41 +0200 |
| commit | 607bd88f57f427a03bedf0ed6dd8f44c90b1e1a1 (patch) | |
| tree | 942c1e887f6ff2174ddac7c0e3cbc0f2eca2aaab /src | |
| parent | a9dd47b7fcde95bbca06485c50326b7b90d930a8 (diff) | |
| download | luajit-607bd88f57f427a03bedf0ed6dd8f44c90b1e1a1.tar.gz luajit-607bd88f57f427a03bedf0ed6dd8f44c90b1e1a1.tar.bz2 luajit-607bd88f57f427a03bedf0ed6dd8f44c90b1e1a1.zip | |
Add potential PHI for number conversions due to type instability, too.
Diffstat (limited to 'src')
| -rw-r--r-- | src/lj_opt_loop.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/src/lj_opt_loop.c b/src/lj_opt_loop.c index 6dd06636..0e03205f 100644 --- a/src/lj_opt_loop.c +++ b/src/lj_opt_loop.c | |||
| @@ -300,13 +300,24 @@ static void loop_unroll(jit_State *J) | |||
| 300 | } | 300 | } |
| 301 | /* Check all loop-carried dependencies for type instability. */ | 301 | /* Check all loop-carried dependencies for type instability. */ |
| 302 | if (!irt_sametype(t, irr->t)) { | 302 | if (!irt_sametype(t, irr->t)) { |
| 303 | if (irt_isnum(t) && irt_isinteger(irr->t)) /* Fix int->num. */ | 303 | if (irt_isinteger(t) && irt_isinteger(irr->t)) |
| 304 | subst[ins] = tref_ref(emitir(IRTN(IR_CONV), ref, IRCONV_NUM_INT)); | 304 | continue; |
| 305 | else if (irt_isnum(t) && irt_isinteger(irr->t)) /* Fix int->num. */ | ||
| 306 | ref = tref_ref(emitir(IRTN(IR_CONV), ref, IRCONV_NUM_INT)); | ||
| 305 | else if (irt_isnum(irr->t) && irt_isinteger(t)) /* Fix num->int. */ | 307 | else if (irt_isnum(irr->t) && irt_isinteger(t)) /* Fix num->int. */ |
| 306 | subst[ins] = tref_ref(emitir(IRTGI(IR_CONV), ref, | 308 | ref = tref_ref(emitir(IRTGI(IR_CONV), ref, |
| 307 | IRCONV_INT_NUM|IRCONV_CHECK)); | 309 | IRCONV_INT_NUM|IRCONV_CHECK)); |
| 308 | else if (!(irt_isinteger(t) && irt_isinteger(irr->t))) | 310 | else |
| 309 | lj_trace_err(J, LJ_TRERR_TYPEINS); | 311 | lj_trace_err(J, LJ_TRERR_TYPEINS); |
| 312 | subst[ins] = (IRRef1)ref; | ||
| 313 | /* May need a PHI for the CONV, too. */ | ||
| 314 | irr = IR(ref); | ||
| 315 | if (ref < invar && !irref_isk(ref) && !irt_isphi(irr->t)) { | ||
| 316 | irt_setphi(irr->t); | ||
| 317 | if (nphi >= LJ_MAX_PHI) | ||
| 318 | lj_trace_err(J, LJ_TRERR_PHIOV); | ||
| 319 | phi[nphi++] = (IRRef1)ref; | ||
| 320 | } | ||
| 310 | } | 321 | } |
| 311 | } | 322 | } |
| 312 | } | 323 | } |
