@@ -2258,6 +2258,25 @@ static uint32_t zend_fetch_prop_type(const zend_script *script, zend_property_in
2258
2258
return zend_convert_type (script , prop_info -> type , pce );
2259
2259
}
2260
2260
2261
+ static bool result_may_be_separated (zend_ssa * ssa , zend_ssa_op * ssa_op )
2262
+ {
2263
+ int tmp_var = ssa_op -> result_def ;
2264
+
2265
+ if (ssa -> vars [tmp_var ].use_chain >= 0
2266
+ && !ssa -> vars [tmp_var ].phi_use_chain ) {
2267
+ zend_ssa_op * use_op = & ssa -> ops [ssa -> vars [tmp_var ].use_chain ];
2268
+
2269
+ /* TODO: analize instructions between ssa_op and use_op */
2270
+ if (use_op == ssa_op + 1 ) {
2271
+ if ((use_op -> op1_use == tmp_var && use_op -> op1_use_chain < 0 )
2272
+ || (use_op -> op2_use == tmp_var && use_op -> op2_use_chain < 0 )) {
2273
+ return 0 ;
2274
+ }
2275
+ }
2276
+ }
2277
+ return 1 ;
2278
+ }
2279
+
2261
2280
static zend_always_inline zend_result _zend_update_type_info (
2262
2281
const zend_op_array * op_array ,
2263
2282
zend_ssa * ssa ,
@@ -3366,11 +3385,11 @@ static zend_always_inline zend_result _zend_update_type_info(
3366
3385
if (prop_info ) {
3367
3386
/* FETCH_OBJ_R/IS for plain property increments reference counter,
3368
3387
so it can't be 1 */
3369
- if (ce && !ce -> create_object ) {
3388
+ if (ce && !ce -> create_object && ! result_may_be_separated ( ssa , ssa_op ) ) {
3370
3389
tmp &= ~MAY_BE_RC1 ;
3371
3390
}
3372
3391
} else {
3373
- if (ce && !ce -> create_object && !ce -> __get ) {
3392
+ if (ce && !ce -> create_object && !ce -> __get && ! result_may_be_separated ( ssa , ssa_op ) ) {
3374
3393
tmp &= ~MAY_BE_RC1 ;
3375
3394
}
3376
3395
}
@@ -3396,7 +3415,9 @@ static zend_always_inline zend_result _zend_update_type_info(
3396
3415
if (opline -> result_type == IS_VAR ) {
3397
3416
tmp |= MAY_BE_REF | MAY_BE_INDIRECT ;
3398
3417
} else {
3399
- tmp &= ~MAY_BE_RC1 ;
3418
+ if (!result_may_be_separated (ssa , ssa_op )) {
3419
+ tmp &= ~MAY_BE_RC1 ;
3420
+ }
3400
3421
if (opline -> opcode == ZEND_FETCH_STATIC_PROP_IS ) {
3401
3422
tmp |= MAY_BE_UNDEF ;
3402
3423
}
0 commit comments