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.
This commit is contained in:
Nikita Popov 2021-12-30 12:03:42 +01:00
parent a0ba10436c
commit 7d2f2a1005

View file

@ -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;