aboutsummaryrefslogtreecommitdiff
path: root/src/lj_crecord.c
diff options
context:
space:
mode:
authorMike Pall <mike>2010-12-09 16:12:59 +0100
committerMike Pall <mike>2010-12-09 16:12:59 +0100
commit1d860909269ebc89f475793b4034d565544a0869 (patch)
tree5e15c5dc1a5377b24ec9238985bea4dc906be17a /src/lj_crecord.c
parent36fed9f3e1af587d331e8c070059163f2ac6432e (diff)
downloadluajit-1d860909269ebc89f475793b4034d565544a0869.tar.gz
luajit-1d860909269ebc89f475793b4034d565544a0869.tar.bz2
luajit-1d860909269ebc89f475793b4034d565544a0869.zip
Strength-reduce 32 to 64 bit widening using scalar evolution analysis.
Diffstat (limited to 'src/lj_crecord.c')
-rw-r--r--src/lj_crecord.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/lj_crecord.c b/src/lj_crecord.c
index c7c99133..566c064b 100644
--- a/src/lj_crecord.c
+++ b/src/lj_crecord.c
@@ -335,15 +335,17 @@ void LJ_FASTCALL recff_cdata_index(jit_State *J, RecordFFData *rd)
335 IRIns *ir = IR(tref_ref(idx)); 335 IRIns *ir = IR(tref_ref(idx));
336 if (LJ_LIKELY(J->flags & JIT_F_OPT_FOLD) && 336 if (LJ_LIKELY(J->flags & JIT_F_OPT_FOLD) &&
337 ir->o == IR_ADD && irref_isk(ir->op2)) { 337 ir->o == IR_ADD && irref_isk(ir->op2)) {
338 IRIns *irk = IR(ir->op2);
339 idx = ir->op1;
338 /* This would be rather difficult in FOLD, so do it here: 340 /* This would be rather difficult in FOLD, so do it here:
339 ** (base+(idx+k)*sz)+ofs ==> (base+idx*sz)+(ofs+k*sz) 341 ** (base+(idx+k)*sz)+ofs ==> (base+idx*sz)+(ofs+k*sz)
340 */ 342 */
341 idx = ir->op1;
342#if LJ_64 343#if LJ_64
343 ofs += (int64_t)ir_kint64(IR(ir->op2))->u64 * sz; 344 if (irk->o == IR_KINT64)
344#else 345 ofs += (ptrdiff_t)ir_kint64(irk)->u64 * sz;
345 ofs += IR(ir->op2)->i * sz; 346 else
346#endif 347#endif
348 ofs += (ptrdiff_t)irk->i * sz;
347 } 349 }
348 idx = emitir(IRT(IR_MUL, IRT_INTP), idx, lj_ir_kintp(J, sz)); 350 idx = emitir(IRT(IR_MUL, IRT_INTP), idx, lj_ir_kintp(J, sz));
349 ptr = emitir(IRT(IR_ADD, IRT_PTR), idx, ptr); 351 ptr = emitir(IRT(IR_ADD, IRT_PTR), idx, ptr);