@@ -228,10 +228,10 @@ static inline void add_operands_to_worklists(context *ctx, zend_op *opline, zend
228
228
if (ssa_op -> result_use >= 0 ) {
229
229
add_to_worklists (ctx , ssa_op -> result_use );
230
230
}
231
- if (ssa_op -> op1_use >= 0 && !zend_has_improper_op1_use (opline )) {
231
+ if (ssa_op -> op1_use >= 0 && !zend_ssa_is_no_val_use (opline , ssa_op , ssa_op -> op1_use )) {
232
232
add_to_worklists (ctx , ssa_op -> op1_use );
233
233
}
234
- if (ssa_op -> op2_use >= 0 ) {
234
+ if (ssa_op -> op2_use >= 0 && ! zend_ssa_is_no_val_use ( opline , ssa_op , ssa_op -> op2_use ) ) {
235
235
add_to_worklists (ctx , ssa_op -> op2_use );
236
236
}
237
237
}
@@ -501,10 +501,12 @@ int dce_optimize_op_array(zend_op_array *op_array, zend_ssa *ssa, zend_bool reor
501
501
/* Improper uses don't count as "uses" for the purpose of instruction elimination,
502
502
* but we have to retain phis defining them. Push those phis to the worklist. */
503
503
FOREACH_INSTR_NUM (i ) {
504
- if (zend_has_improper_op1_use (& op_array -> opcodes [i ])) {
505
- ZEND_ASSERT (ssa -> ops [i ].op1_use >= 0 );
504
+ if (ssa -> ops [i ].op1_use >= 0 && zend_ssa_is_no_val_use (& op_array -> opcodes [i ], & ssa -> ops [i ], ssa -> ops [i ].op1_use )) {
506
505
add_to_phi_worklist_only (& ctx , ssa -> ops [i ].op1_use );
507
506
}
507
+ if (ssa -> ops [i ].op2_use >= 0 && zend_ssa_is_no_val_use (& op_array -> opcodes [i ], & ssa -> ops [i ], ssa -> ops [i ].op2_use )) {
508
+ add_to_phi_worklist_only (& ctx , ssa -> ops [i ].op2_use );
509
+ }
508
510
} FOREACH_INSTR_NUM_END ();
509
511
510
512
/* Propagate this information backwards, marking any phi with an improperly used
0 commit comments