Parcourir la source

RETF modifies BASE. Treat it like a store or it gets CSEd.

Mike Pall il y a 16 ans
Parent
commit
370c868c31
2 fichiers modifiés avec 3 ajouts et 1 suppressions
  1. 2 1
      src/lj_ir.h
  2. 1 0
      src/lj_opt_fold.c

+ 2 - 1
src/lj_ir.h

@@ -34,7 +34,7 @@
   _(NE,		GC, ref, ref) \
   _(NE,		GC, ref, ref) \
   \
   \
   _(ABC,	G , ref, ref) \
   _(ABC,	G , ref, ref) \
-  _(RETF,	G , ref, ref) \
+  _(RETF,	SG, ref, ref) \
   \
   \
   _(LT,		G , ref, ref) \
   _(LT,		G , ref, ref) \
   _(GE,		G , ref, ref) \
   _(GE,		G , ref, ref) \
@@ -288,6 +288,7 @@ typedef enum {
 #define IRM_GC			(IRM_G|IRM_C)
 #define IRM_GC			(IRM_G|IRM_C)
 #define IRM_RG			(IRM_R|IRM_G)
 #define IRM_RG			(IRM_R|IRM_G)
 #define IRM_LG			(IRM_L|IRM_G)
 #define IRM_LG			(IRM_L|IRM_G)
+#define IRM_SG			(IRM_S|IRM_G)
 
 
 #define irm_op1(m)		(cast(IRMode, (m)&3))
 #define irm_op1(m)		(cast(IRMode, (m)&3))
 #define irm_op2(m)		(cast(IRMode, ((m)>>2)&3))
 #define irm_op2(m)		(cast(IRMode, ((m)>>2)&3))

+ 1 - 0
src/lj_opt_fold.c

@@ -1326,6 +1326,7 @@ LJFOLDX(lj_opt_dse_fstore)
 LJFOLD(NEWREF any any)  /* Treated like a store. */
 LJFOLD(NEWREF any any)  /* Treated like a store. */
 LJFOLD(CALLS any any)
 LJFOLD(CALLS any any)
 LJFOLD(CALLL any any)  /* Safeguard fallback. */
 LJFOLD(CALLL any any)  /* Safeguard fallback. */
+LJFOLD(RETF any any)  /* Modifies BASE. */
 LJFOLD(TNEW any any)
 LJFOLD(TNEW any any)
 LJFOLD(TDUP any)
 LJFOLD(TDUP any)
 LJFOLDX(lj_ir_emit)
 LJFOLDX(lj_ir_emit)