Fix JIT QM_ASSIGN may be optimized out when op1 is null #13610
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
ZVAL_COPY_CONST
and its variations avoid updatingZ_TYPE_P(dst_addr)
when it's known to have the right value already, based ondst_info
. However, when emitting code forZEND_QM_ASSIGN
, we addMAY_BE_NULL
todst_info
when the SSA type and stack types disagree. I'm assuming this is done to force a type store here:php-src/ext/opcache/jit/zend_jit_x86.dasc
Lines 959 to 963 in 88e90c6
Both of these conditions will be true unless
Z_TYPE_P(zv)
is NULL, in which case the type store is erroneously eliminated.In this change I set
res_use_info
(dst_info
) to0
to force a type store.MAY_BE_ANY
would also work.This fixes #13508, but I'm not 100% confident this is correct.
ZEND_ASSIGN
may have the same issue and I will look at it later.