diff options
author | Dmitry Stogov <dmitry@zend.com> | 2020-10-20 02:27:24 +0300 |
---|---|---|
committer | Dmitry Stogov <dmitry@zend.com> | 2020-10-20 02:27:24 +0300 |
commit | ee5b1dd6dc27e750dc55c5cebfc30fec2f2b6e18 (patch) | |
tree | 67b086a97388c9225126dce6d952d8d306a3c289 | |
parent | fc2d477c5ba678ffc854f35e86a66a84cea23fad (diff) | |
download | php-git-ee5b1dd6dc27e750dc55c5cebfc30fec2f2b6e18.tar.gz |
Fixed range propagation
-rw-r--r-- | ext/opcache/Optimizer/zend_inference.c | 45 |
1 files changed, 16 insertions, 29 deletions
diff --git a/ext/opcache/Optimizer/zend_inference.c b/ext/opcache/Optimizer/zend_inference.c index 1dbbeb97f0..be9add10cf 100644 --- a/ext/opcache/Optimizer/zend_inference.c +++ b/ext/opcache/Optimizer/zend_inference.c @@ -1343,16 +1343,20 @@ int zend_inference_propagate_range(const zend_op_array *op_array, zend_ssa *ssa, break; case ZEND_ASSIGN_DIM: case ZEND_ASSIGN_OBJ: - if (ssa_op->op1_def == var) { - if ((opline+1)->opcode == ZEND_OP_DATA) { - opline++; - ssa_op++; + case ZEND_ASSIGN_STATIC_PROP: + case ZEND_ASSIGN_DIM_OP: + case ZEND_ASSIGN_OBJ_OP: + case ZEND_ASSIGN_STATIC_PROP_OP: + if ((ssa_op+1)->op1_def == var) { + opline++; + ssa_op++; + if (OP1_HAS_RANGE()) { tmp->min = OP1_MIN_RANGE(); tmp->max = OP1_MAX_RANGE(); tmp->underflow = OP1_RANGE_UNDERFLOW(); tmp->overflow = OP1_RANGE_OVERFLOW(); - return 1; } + return 1; } break; case ZEND_ASSIGN_OP: @@ -1365,31 +1369,14 @@ int zend_inference_propagate_range(const zend_op_array *op_array, zend_ssa *ssa, } } break; - case ZEND_ASSIGN_DIM_OP: - case ZEND_ASSIGN_OBJ_OP: - case ZEND_ASSIGN_STATIC_PROP_OP: - if ((opline+1)->opcode == ZEND_OP_DATA) { - if ((ssa_op+1)->op1_def == var) { - opline++; - ssa_op++; - if (OP1_HAS_RANGE()) { - tmp->min = OP1_MIN_RANGE(); - tmp->max = OP1_MAX_RANGE(); - tmp->underflow = OP1_RANGE_UNDERFLOW(); - tmp->overflow = OP1_RANGE_OVERFLOW(); - return 1; - } - } - } - break; case ZEND_OP_DATA: - if ((opline-1)->opcode == ZEND_ASSIGN_DIM || - (opline-1)->opcode == ZEND_ASSIGN_OBJ || - ((opline-1)->opcode == ZEND_ASSIGN_OP && - ((opline-1)->extended_value == ZEND_ADD || - (opline-1)->extended_value == ZEND_SUB || - (opline-1)->extended_value == ZEND_MUL))) { - if (ssa_op->op1_def == var) { + if (ssa_op->op1_def == var) { + if ((opline-1)->opcode == ZEND_ASSIGN_DIM || + (opline-1)->opcode == ZEND_ASSIGN_OBJ || + (opline-1)->opcode == ZEND_ASSIGN_STATIC_PROP || + (opline-1)->opcode == ZEND_ASSIGN_DIM_OP || + (opline-1)->opcode == ZEND_ASSIGN_OBJ_OP || + (opline-1)->opcode == ZEND_ASSIGN_STATIC_PROP_OP) { if (OP1_HAS_RANGE()) { tmp->min = OP1_MIN_RANGE(); tmp->max = OP1_MAX_RANGE(); |