summaryrefslogtreecommitdiff
path: root/ext/opcache/Optimizer/pass2.c
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2017-04-10 22:09:34 +0200
committerNikita Popov <nikita.ppv@gmail.com>2017-04-10 22:09:34 +0200
commit6f950e83eb1467521853d6628f514d2eebef7ebb (patch)
treef71a1e1663637eb7d2035c5ee0c55815d815cff4 /ext/opcache/Optimizer/pass2.c
parent8c53c346d45f7623d542b62b1622d6c7a8bf7c42 (diff)
downloadphp-git-6f950e83eb1467521853d6628f514d2eebef7ebb.tar.gz
Fix JMPZ+JMP => NOP+JMP optimization
Diffstat (limited to 'ext/opcache/Optimizer/pass2.c')
-rw-r--r--ext/opcache/Optimizer/pass2.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/ext/opcache/Optimizer/pass2.c b/ext/opcache/Optimizer/pass2.c
index 4abaa30fbc..098be5146b 100644
--- a/ext/opcache/Optimizer/pass2.c
+++ b/ext/opcache/Optimizer/pass2.c
@@ -156,7 +156,14 @@ void zend_optimizer_pass2(zend_op_array *op_array)
/* JMPNZ(X, L1), JMP(L2) => JMPZNZ(X, L2, L1) */
if (ZEND_OP2(opline).opline_num == ZEND_OP1(opline + 1).opline_num) {
/* JMPZ(X, L1), JMP(L1) => NOP, JMP(L1) */
- MAKE_NOP(opline);
+ if (opline->op1_type == IS_CV) {
+ break;
+ } else if (opline->op1_type & (IS_TMP_VAR|IS_VAR)) {
+ opline->opcode = ZEND_FREE;
+ opline->op2.num = 0;
+ } else {
+ MAKE_NOP(opline);
+ }
} else {
if (opline->opcode == ZEND_JMPZ) {
opline->extended_value = ZEND_OP1(opline + 1).opline_num;