Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions Optimizer/pass1_5.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,20 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) {

while (opline < end) {
switch (opline->opcode) {
case ZEND_INSTANCEOF:
if ((opline + 1)->opcode == ZEND_FREE) { /* useless instanceof */
MAKE_NOP(opline);
MAKE_NOP((opline + 1));

/* It is safe to remove FETCH_CLASS, it was ZEND_FETCH_CLASS_NO_AUTOLOAD anyway */
if ((opline - 1)->opcode == ZEND_FETCH_CLASS) {
if (ZEND_OP2_TYPE(opline - 1) == IS_CONST) {
literal_dtor(&ZEND_OP2_LITERAL(opline - 1));
}
MAKE_NOP((opline -1));
}
}
break;
case ZEND_ADD:
case ZEND_SUB:
case ZEND_MUL:
Expand Down