com php-src: Add DCE support for ARRAY_KEY_EXISTS: ext/ opcache/Optimizer/dce.c ext/opcache/Optimizer/zend_infere nce.c
| From: | Nikita Popov | Date: | Thu, 05 Dec 2019 13:55:22 +0000 |
| Subject: | com php-src: Add DCE support for ARRAY_KEY_EXISTS: ext/ opcache/Optimizer/dce.c ext/opcache/Optimizer/zend_infere nce.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-109401@lists.php.net to get a copy of this message | ||
Commit: 9e403d65d8515422edf87949bcb60667cd737996
Author: Nikita Popov <nikita.ppv@gmail.com> Thu, 5 Dec 2019 14:51:36 +0100
Parents: 1c4ad17cc1e483201a36b027f20aab1f91d19628
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=9e403d65d8515422edf87949bcb60667cd737996
Log:
Add DCE support for ARRAY_KEY_EXISTS
Changed paths:
M ext/opcache/Optimizer/dce.c
M ext/opcache/Optimizer/zend_inference.c
Diff:
diff --git a/ext/opcache/Optimizer/dce.c b/ext/opcache/Optimizer/dce.c
index 2992bb60b37..ea81687bf43 100644
--- a/ext/opcache/Optimizer/dce.c
+++ b/ext/opcache/Optimizer/dce.c
@@ -124,6 +124,7 @@ static inline zend_bool may_have_side_effects(
case ZEND_IN_ARRAY:
case ZEND_FUNC_NUM_ARGS:
case ZEND_FUNC_GET_ARGS:
+ case ZEND_ARRAY_KEY_EXISTS:
/* No side effects */
return 0;
case ZEND_ROPE_END:
diff --git a/ext/opcache/Optimizer/zend_inference.c b/ext/opcache/Optimizer/zend_inference.c
index 975853a9eb5..1838fe387ba 100644
--- a/ext/opcache/Optimizer/zend_inference.c
+++ b/ext/opcache/Optimizer/zend_inference.c
@@ -4634,6 +4634,14 @@ int zend_may_throw(const zend_op *opline, const zend_op_array *op_array,
zend_ss
default:
return 1;
}
+ case ZEND_ARRAY_KEY_EXISTS:
+ if ((t2 & MAY_BE_ANY) != MAY_BE_ARRAY) {
+ return 1;
+ }
+ if ((t1 & (MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE))) {
+ return 1;
+ }
+ return 0;
default:
return 1;
}