From 7d2f2a100582ba95d4da082bcbd629ef48549084 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Thu, 30 Dec 2021 12:03:42 +0100 Subject: [PATCH] Remove an incorrect JMPZNZ optimization This is already skipped for TMP/VAR, but also needs to be skipped for CV, because we need to insert CHECK_VAR in that case, if we're being pedantic. That leaves us with CONST as the only case we can handle, which is already covered by constant folding. This optimization never actually triggers in our tests, so it's not a big loss. --- Zend/Optimizer/pass3.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/Zend/Optimizer/pass3.c b/Zend/Optimizer/pass3.c index 2b0fa7aa52e..f96e071311f 100644 --- a/Zend/Optimizer/pass3.c +++ b/Zend/Optimizer/pass3.c @@ -340,15 +340,6 @@ optimize_jmpznz: opline->extended_value = ZEND_OPLINE_TO_OFFSET(opline, target); } - if (ZEND_OP2_JMP_ADDR(opline) == target && - !(opline->op1_type & (IS_VAR|IS_TMP_VAR))) { - /* JMPZNZ(?,L,L) -> JMP(L) */ - opline->opcode = ZEND_JMP; - ZEND_SET_OP_JMP_ADDR(opline, opline->op1, target); - SET_UNUSED(opline->op1); - SET_UNUSED(opline->op2); - opline->extended_value = 0; - } /* Don't convert JMPZNZ back to JMPZ/JMPNZ, because the following JMP is not removed yet. */ break;