]> git.ipfire.org Git - thirdparty/LuaJIT.git/commitdiff
Generate EQ(HREF, niltv) for load path, too (better CSE).
authorMike Pall <mike>
Sun, 28 Mar 2010 04:49:09 +0000 (06:49 +0200)
committerMike Pall <mike>
Sun, 28 Mar 2010 04:49:09 +0000 (06:49 +0200)
src/lj_record.c

index 29c024bfece663faacf36366183ae6d69553e786..e89d9c26fd18c4dc74316b863b5c213d3ffdd049 100644 (file)
@@ -981,7 +981,13 @@ static TRef rec_idx(jit_State *J, RecordIndex *ix)
 
   if (ix->val == 0) {  /* Indexed load */
     IRType t = itype2irt(oldv);
-    TRef res = emitir(IRTG(loadop, t), xref, 0);
+    TRef res;
+    if (oldv == niltvg(J2G(J))) {
+      emitir(IRTG(IR_EQ, IRT_PTR), xref, lj_ir_kptr(J, niltvg(J2G(J))));
+      res = TREF_NIL;
+    } else {
+      res = emitir(IRTG(loadop, t), xref, 0);
+    }
     if (t == IRT_NIL && ix->idxchain && rec_mm_lookup(J, ix, MM_index))
       goto handlemm;
     if (irtype_ispri(t)) res = TREF_PRI(t);  /* Canonicalize primitives. */