Skip to content

Commit 9e403d6

Browse files
committed
Add DCE support for ARRAY_KEY_EXISTS
1 parent 1c4ad17 commit 9e403d6

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

ext/opcache/Optimizer/dce.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ static inline zend_bool may_have_side_effects(
124124
case ZEND_IN_ARRAY:
125125
case ZEND_FUNC_NUM_ARGS:
126126
case ZEND_FUNC_GET_ARGS:
127+
case ZEND_ARRAY_KEY_EXISTS:
127128
/* No side effects */
128129
return 0;
129130
case ZEND_ROPE_END:

ext/opcache/Optimizer/zend_inference.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4634,6 +4634,14 @@ int zend_may_throw(const zend_op *opline, const zend_op_array *op_array, zend_ss
46344634
default:
46354635
return 1;
46364636
}
4637+
case ZEND_ARRAY_KEY_EXISTS:
4638+
if ((t2 & MAY_BE_ANY) != MAY_BE_ARRAY) {
4639+
return 1;
4640+
}
4641+
if ((t1 & (MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE))) {
4642+
return 1;
4643+
}
4644+
return 0;
46374645
default:
46384646
return 1;
46394647
}

0 commit comments

Comments
 (0)