Skip to content

Commit ee5b1dd

Browse files
committed
Fixed range propagation
1 parent fc2d477 commit ee5b1dd

File tree

1 file changed

+16
-29
lines changed

1 file changed

+16
-29
lines changed

ext/opcache/Optimizer/zend_inference.c

Lines changed: 16 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1343,16 +1343,20 @@ int zend_inference_propagate_range(const zend_op_array *op_array, zend_ssa *ssa,
13431343
break;
13441344
case ZEND_ASSIGN_DIM:
13451345
case ZEND_ASSIGN_OBJ:
1346-
if (ssa_op->op1_def == var) {
1347-
if ((opline+1)->opcode == ZEND_OP_DATA) {
1348-
opline++;
1349-
ssa_op++;
1346+
case ZEND_ASSIGN_STATIC_PROP:
1347+
case ZEND_ASSIGN_DIM_OP:
1348+
case ZEND_ASSIGN_OBJ_OP:
1349+
case ZEND_ASSIGN_STATIC_PROP_OP:
1350+
if ((ssa_op+1)->op1_def == var) {
1351+
opline++;
1352+
ssa_op++;
1353+
if (OP1_HAS_RANGE()) {
13501354
tmp->min = OP1_MIN_RANGE();
13511355
tmp->max = OP1_MAX_RANGE();
13521356
tmp->underflow = OP1_RANGE_UNDERFLOW();
13531357
tmp->overflow = OP1_RANGE_OVERFLOW();
1354-
return 1;
13551358
}
1359+
return 1;
13561360
}
13571361
break;
13581362
case ZEND_ASSIGN_OP:
@@ -1365,31 +1369,14 @@ int zend_inference_propagate_range(const zend_op_array *op_array, zend_ssa *ssa,
13651369
}
13661370
}
13671371
break;
1368-
case ZEND_ASSIGN_DIM_OP:
1369-
case ZEND_ASSIGN_OBJ_OP:
1370-
case ZEND_ASSIGN_STATIC_PROP_OP:
1371-
if ((opline+1)->opcode == ZEND_OP_DATA) {
1372-
if ((ssa_op+1)->op1_def == var) {
1373-
opline++;
1374-
ssa_op++;
1375-
if (OP1_HAS_RANGE()) {
1376-
tmp->min = OP1_MIN_RANGE();
1377-
tmp->max = OP1_MAX_RANGE();
1378-
tmp->underflow = OP1_RANGE_UNDERFLOW();
1379-
tmp->overflow = OP1_RANGE_OVERFLOW();
1380-
return 1;
1381-
}
1382-
}
1383-
}
1384-
break;
13851372
case ZEND_OP_DATA:
1386-
if ((opline-1)->opcode == ZEND_ASSIGN_DIM ||
1387-
(opline-1)->opcode == ZEND_ASSIGN_OBJ ||
1388-
((opline-1)->opcode == ZEND_ASSIGN_OP &&
1389-
((opline-1)->extended_value == ZEND_ADD ||
1390-
(opline-1)->extended_value == ZEND_SUB ||
1391-
(opline-1)->extended_value == ZEND_MUL))) {
1392-
if (ssa_op->op1_def == var) {
1373+
if (ssa_op->op1_def == var) {
1374+
if ((opline-1)->opcode == ZEND_ASSIGN_DIM ||
1375+
(opline-1)->opcode == ZEND_ASSIGN_OBJ ||
1376+
(opline-1)->opcode == ZEND_ASSIGN_STATIC_PROP ||
1377+
(opline-1)->opcode == ZEND_ASSIGN_DIM_OP ||
1378+
(opline-1)->opcode == ZEND_ASSIGN_OBJ_OP ||
1379+
(opline-1)->opcode == ZEND_ASSIGN_STATIC_PROP_OP) {
13931380
if (OP1_HAS_RANGE()) {
13941381
tmp->min = OP1_MIN_RANGE();
13951382
tmp->max = OP1_MAX_RANGE();

0 commit comments

Comments
 (0)