Don't optimize function if inference failed

This was respected only for the single-function optimizations, not
in func-info mode.
This commit is contained in:
Nikita Popov 2018-10-25 16:31:10 +02:00
parent 78c2e0e342
commit b9431ef4d5

View File

@ -1488,8 +1488,11 @@ int zend_optimize_script(zend_script *script, zend_long optimization_level, zend
for (i = 0; i < call_graph.op_arrays_count; i++) {
func_info = ZEND_FUNC_INFO(call_graph.op_arrays[i]);
if (func_info) {
zend_dfa_analyze_op_array(call_graph.op_arrays[i], &ctx, &func_info->ssa);
func_info->flags = func_info->ssa.cfg.flags;
if (zend_dfa_analyze_op_array(call_graph.op_arrays[i], &ctx, &func_info->ssa) == SUCCESS) {
func_info->flags = func_info->ssa.cfg.flags;
} else {
ZEND_SET_FUNC_INFO(call_graph.op_arrays[i], NULL);
}
}
}