Lines Matching refs:ssa

41 …d_result zend_dfa_analyze_op_array(zend_op_array *op_array, zend_optimizer_ctx *ctx, zend_ssa *ssa)  in zend_dfa_analyze_op_array()  argument
51 memset(ssa, 0, sizeof(zend_ssa)); in zend_dfa_analyze_op_array()
53 zend_build_cfg(&ctx->arena, op_array, ZEND_CFG_NO_ENTRY_PREDECESSORS, &ssa->cfg); in zend_dfa_analyze_op_array()
55 if ((ssa->cfg.flags & ZEND_FUNC_INDIRECT_VAR_ACCESS)) { in zend_dfa_analyze_op_array()
60 zend_cfg_build_predecessors(&ctx->arena, &ssa->cfg); in zend_dfa_analyze_op_array()
63 zend_dump_op_array(op_array, ZEND_DUMP_CFG, "dfa cfg", &ssa->cfg); in zend_dfa_analyze_op_array()
67 zend_cfg_compute_dominators_tree(op_array, &ssa->cfg); in zend_dfa_analyze_op_array()
70 zend_cfg_identify_loops(op_array, &ssa->cfg); in zend_dfa_analyze_op_array()
73 zend_dump_dominators(op_array, &ssa->cfg); in zend_dfa_analyze_op_array()
83 if (zend_build_ssa(&ctx->arena, ctx->script, op_array, build_flags, ssa) == FAILURE) { in zend_dfa_analyze_op_array()
88 zend_dump_op_array(op_array, ZEND_DUMP_SSA, "dfa ssa", ssa); in zend_dfa_analyze_op_array()
92 zend_ssa_compute_use_def_chains(&ctx->arena, op_array, ssa); in zend_dfa_analyze_op_array()
94 zend_ssa_find_false_dependencies(op_array, ssa); in zend_dfa_analyze_op_array()
96 zend_ssa_find_sccs(op_array, ssa); in zend_dfa_analyze_op_array()
98 …if (zend_ssa_inference(&ctx->arena, op_array, ctx->script, ssa, ctx->optimization_level) == FAILUR… in zend_dfa_analyze_op_array()
102 if (zend_ssa_escape_analysis(ctx->script, op_array, ssa) == FAILURE) { in zend_dfa_analyze_op_array()
107 zend_dump_ssa_variables(op_array, ssa, 0); in zend_dfa_analyze_op_array()
113 static void zend_ssa_remove_nops(zend_op_array *op_array, zend_ssa *ssa, zend_optimizer_ctx *ctx) in zend_ssa_remove_nops() argument
115 zend_basic_block *blocks = ssa->cfg.blocks; in zend_ssa_remove_nops()
116 zend_basic_block *blocks_end = blocks + ssa->cfg.blocks_count; in zend_ssa_remove_nops()
163 ssa->ops[target] = ssa->ops[i]; in zend_ssa_remove_nops()
164 ssa->cfg.map[target] = b - blocks; in zend_ssa_remove_nops()
200 for (j = 0; j < ssa->vars_count; j++) { in zend_ssa_remove_nops()
201 if (ssa->vars[j].definition >= 0) { in zend_ssa_remove_nops()
202 ssa->vars[j].definition -= shiftlist[ssa->vars[j].definition]; in zend_ssa_remove_nops()
204 if (ssa->vars[j].use_chain >= 0) { in zend_ssa_remove_nops()
205 ssa->vars[j].use_chain -= shiftlist[ssa->vars[j].use_chain]; in zend_ssa_remove_nops()
209 if (ssa->ops[i].op1_use_chain >= 0) { in zend_ssa_remove_nops()
210 ssa->ops[i].op1_use_chain -= shiftlist[ssa->ops[i].op1_use_chain]; in zend_ssa_remove_nops()
212 if (ssa->ops[i].op2_use_chain >= 0) { in zend_ssa_remove_nops()
213 ssa->ops[i].op2_use_chain -= shiftlist[ssa->ops[i].op2_use_chain]; in zend_ssa_remove_nops()
215 if (ssa->ops[i].res_use_chain >= 0) { in zend_ssa_remove_nops()
216 ssa->ops[i].res_use_chain -= shiftlist[ssa->ops[i].res_use_chain]; in zend_ssa_remove_nops()
295 const zend_script *script, zend_op_array *op_array, zend_ssa *ssa, zend_ssa_op *ssa_op) { in can_elide_return_type_check() argument
297 zend_ssa_var_info *use_info = &ssa->var_info[ssa_op->op1_use]; in can_elide_return_type_check()
322 zend_op_array *op_array, zend_ssa *ssa, zend_op *opline, int src_var, uint32_t cv_var) { in opline_supports_assign_contraction() argument
345 uint32_t type = ssa->var_info[src_var].type; in opline_supports_assign_contraction()
376 && zend_may_throw(opline, &ssa->ops[ssa->vars[src_var].definition], op_array, ssa)) { in opline_supports_assign_contraction()
383 static bool variable_defined_or_used_in_range(zend_ssa *ssa, int var, int start, int end) in variable_defined_or_used_in_range() argument
386 const zend_ssa_op *ssa_op = &ssa->ops[start]; in variable_defined_or_used_in_range()
387 if ((ssa_op->op1_def >= 0 && ssa->vars[ssa_op->op1_def].var == var) || in variable_defined_or_used_in_range()
388 (ssa_op->op2_def >= 0 && ssa->vars[ssa_op->op2_def].var == var) || in variable_defined_or_used_in_range()
389 (ssa_op->result_def >= 0 && ssa->vars[ssa_op->result_def].var == var) || in variable_defined_or_used_in_range()
390 (ssa_op->op1_use >= 0 && ssa->vars[ssa_op->op1_use].var == var) || in variable_defined_or_used_in_range()
391 (ssa_op->op2_use >= 0 && ssa->vars[ssa_op->op2_use].var == var) || in variable_defined_or_used_in_range()
392 (ssa_op->result_use >= 0 && ssa->vars[ssa_op->result_use].var == var) in variable_defined_or_used_in_range()
401 int zend_dfa_optimize_calls(zend_op_array *op_array, zend_ssa *ssa) in zend_dfa_optimize_calls() argument
475 zend_ssa_op *ssa_op = ssa->ops + op_num; in zend_dfa_optimize_calls()
480 zend_ssa_var *var = ssa->vars + var_num; in zend_dfa_optimize_calls()
483 zend_ssa_unlink_use_chain(ssa, op_num, ssa_op->op1_use); in zend_dfa_optimize_calls()
487 ssa_op = ssa->ops + op_num; in zend_dfa_optimize_calls()
511 ssa_op = ssa->ops + op_num; in zend_dfa_optimize_calls()
514 int use = ssa->vars[var].use_chain; in zend_dfa_optimize_calls()
519 if (ssa->vars[var].phi_use_chain == NULL in zend_dfa_optimize_calls()
520 && ssa->ops[use].op1_use == var in zend_dfa_optimize_calls()
521 && ssa->ops[use].op1_use_chain == -1 in zend_dfa_optimize_calls()
538 static zend_always_inline void take_successor_0(zend_ssa *ssa, int block_num, zend_basic_block *blo… in take_successor_0() argument
542 zend_ssa_remove_predecessor(ssa, block_num, block->successors[1]); in take_successor_0()
548 static zend_always_inline void take_successor_1(zend_ssa *ssa, int block_num, zend_basic_block *blo… in take_successor_1() argument
552 zend_ssa_remove_predecessor(ssa, block_num, block->successors[0]); in take_successor_1()
559 static zend_always_inline void take_successor_ex(zend_ssa *ssa, int block_num, zend_basic_block *bl… in take_successor_ex() argument
565 zend_ssa_remove_predecessor(ssa, block_num, block->successors[i]); in take_successor_ex()
585 static void replace_predecessor(zend_ssa *ssa, int block_id, int old_pred, int new_pred) { in replace_predecessor() argument
586 zend_basic_block *block = &ssa->cfg.blocks[block_id]; in replace_predecessor()
587 int *predecessors = &ssa->cfg.predecessors[block->predecessor_offset]; in replace_predecessor()
616 for (phi = ssa->blocks[block_id].phis; phi; phi = phi->next) { in replace_predecessor()
620 ssa, phi->ssa_var, phi->sources[0], /* update_types */ 0); in replace_predecessor()
621 zend_ssa_remove_phi(ssa, phi); in replace_predecessor()
636 static void zend_ssa_replace_control_link(zend_op_array *op_array, zend_ssa *ssa, int from, int to,… in zend_ssa_replace_control_link() argument
638 zend_basic_block *src = &ssa->cfg.blocks[from]; in zend_ssa_replace_control_link()
639 zend_basic_block *old = &ssa->cfg.blocks[to]; in zend_ssa_replace_control_link()
640 zend_basic_block *dst = &ssa->cfg.blocks[new_to]; in zend_ssa_replace_control_link()
706 replace_predecessor(ssa, new_to, to, from); in zend_ssa_replace_control_link()
709 static void zend_ssa_unlink_block(zend_op_array *op_array, zend_ssa *ssa, zend_basic_block *block, … in zend_ssa_unlink_block() argument
711 if (block->predecessors_count == 1 && ssa->blocks[block_num].phis == NULL) { in zend_ssa_unlink_block()
716 predecessors = &ssa->cfg.predecessors[block->predecessor_offset]; in zend_ssa_unlink_block()
718 zend_basic_block *pred_block = &ssa->cfg.blocks[predecessors[0]]; in zend_ssa_unlink_block()
729 zend_ssa_replace_control_link(op_array, ssa, predecessors[i], block_num, block->successors[0]); in zend_ssa_unlink_block()
731 zend_ssa_remove_block(op_array, ssa, block_num); in zend_ssa_unlink_block()
734 int ssa_var = ssa->ops[fe_fetch_block->start + fe_fetch_block->len - 1].op2_def; in zend_ssa_unlink_block()
736 zend_ssa_remove_uses_of_var(ssa, ssa_var); in zend_ssa_unlink_block()
742 static int zend_dfa_optimize_jmps(zend_op_array *op_array, zend_ssa *ssa) in zend_dfa_optimize_jmps() argument
747 for (block_num = 1; block_num < ssa->cfg.blocks_count; block_num++) { in zend_dfa_optimize_jmps()
748 zend_basic_block *block = &ssa->cfg.blocks[block_num]; in zend_dfa_optimize_jmps()
755 zend_ssa_unlink_block(op_array, ssa, block, block_num); in zend_dfa_optimize_jmps()
760 while (block_num < ssa->cfg.blocks_count in zend_dfa_optimize_jmps()
761 && !(ssa->cfg.blocks[block_num].flags & ZEND_BB_REACHABLE)) { in zend_dfa_optimize_jmps()
764 while (block_num < ssa->cfg.blocks_count) { in zend_dfa_optimize_jmps()
766 zend_basic_block *block = &ssa->cfg.blocks[block_num]; in zend_dfa_optimize_jmps()
772 while (next_block_num < ssa->cfg.blocks_count in zend_dfa_optimize_jmps()
773 && !(ssa->cfg.blocks[next_block_num].flags & ZEND_BB_REACHABLE)) { in zend_dfa_optimize_jmps()
774 if (ssa->cfg.blocks[next_block_num].flags & ZEND_BB_UNREACHABLE_FREE) { in zend_dfa_optimize_jmps()
783 ssa_op = ssa->ops + op_num; in zend_dfa_optimize_jmps()
800 take_successor_1(ssa, block_num, block); in zend_dfa_optimize_jmps()
805 take_successor_0(ssa, block_num, block); in zend_dfa_optimize_jmps()
810 take_successor_0(ssa, block_num, block); in zend_dfa_optimize_jmps()
815 zend_ssa_remove_instr(ssa, opline, ssa_op); in zend_dfa_optimize_jmps()
831 take_successor_0(ssa, block_num, block); in zend_dfa_optimize_jmps()
836 take_successor_1(ssa, block_num, block); in zend_dfa_optimize_jmps()
841 take_successor_0(ssa, block_num, block); in zend_dfa_optimize_jmps()
846 zend_ssa_remove_instr(ssa, opline, ssa_op); in zend_dfa_optimize_jmps()
857 if (ssa->vars[ssa_op->result_def].use_chain < 0 in zend_dfa_optimize_jmps()
858 && ssa->vars[ssa_op->result_def].phi_use_chain == NULL) { in zend_dfa_optimize_jmps()
861 zend_ssa_remove_result_def(ssa, ssa_op); in zend_dfa_optimize_jmps()
866 take_successor_1(ssa, block_num, block); in zend_dfa_optimize_jmps()
871 if (ssa->vars[ssa_op->result_def].use_chain < 0 in zend_dfa_optimize_jmps()
872 && ssa->vars[ssa_op->result_def].phi_use_chain == NULL) { in zend_dfa_optimize_jmps()
875 zend_ssa_remove_result_def(ssa, ssa_op); in zend_dfa_optimize_jmps()
880 take_successor_1(ssa, block_num, block); in zend_dfa_optimize_jmps()
885 if (ssa->vars[ssa_op->result_def].use_chain < 0 in zend_dfa_optimize_jmps()
886 && ssa->vars[ssa_op->result_def].phi_use_chain == NULL) { in zend_dfa_optimize_jmps()
889 zend_ssa_remove_result_def(ssa, ssa_op); in zend_dfa_optimize_jmps()
895 take_successor_1(ssa, block_num, block); in zend_dfa_optimize_jmps()
896 zend_ssa_remove_result_def(ssa, ssa_op); in zend_dfa_optimize_jmps()
903 zend_ssa_var *var = &ssa->vars[ssa_op->result_def]; in zend_dfa_optimize_jmps()
907 zend_ssa_remove_result_def(ssa, ssa_op); in zend_dfa_optimize_jmps()
910 take_successor_1(ssa, block_num, block); in zend_dfa_optimize_jmps()
915 zend_ssa_remove_result_def(ssa, ssa_op); in zend_dfa_optimize_jmps()
917 take_successor_0(ssa, block_num, block); in zend_dfa_optimize_jmps()
925 zend_ssa_var *var = &ssa->vars[ssa_op->result_def]; in zend_dfa_optimize_jmps()
931 zend_ssa_remove_result_def(ssa, ssa_op); in zend_dfa_optimize_jmps()
933 take_successor_0(ssa, block_num, block); in zend_dfa_optimize_jmps()
936 zend_ssa_remove_result_def(ssa, ssa_op); in zend_dfa_optimize_jmps()
939 take_successor_1(ssa, block_num, block); in zend_dfa_optimize_jmps()
964 take_successor_ex(ssa, block_num, block, block->successors[block->successors_count - 1]); in zend_dfa_optimize_jmps()
989 take_successor_ex(ssa, block_num, block, ssa->cfg.map[target]); in zend_dfa_optimize_jmps()
998 zend_ssa_unlink_block(op_array, ssa, block, block_num); in zend_dfa_optimize_jmps()
1003 && !(ssa->cfg.blocks[block_num].flags & ZEND_BB_REACHABLE)); in zend_dfa_optimize_jmps()
1021 static bool zend_dfa_try_to_replace_result(zend_op_array *op_array, zend_ssa *ssa, int def, int cv_… in zend_dfa_try_to_replace_result() argument
1023 int result_var = ssa->ops[def].result_def; in zend_dfa_try_to_replace_result()
1024 uint32_t cv = EX_NUM_TO_VAR(ssa->vars[cv_var].var); in zend_dfa_try_to_replace_result()
1027 && !(ssa->var_info[cv_var].type & MAY_BE_REF) in zend_dfa_try_to_replace_result()
1028 && ssa->vars[cv_var].alias == NO_ALIAS in zend_dfa_try_to_replace_result()
1029 && ssa->vars[result_var].phi_use_chain == NULL in zend_dfa_try_to_replace_result()
1030 && ssa->vars[result_var].sym_use_chain == NULL) { in zend_dfa_try_to_replace_result()
1031 int use = ssa->vars[result_var].use_chain; in zend_dfa_try_to_replace_result()
1034 && zend_ssa_next_use(ssa->ops, result_var, use) < 0 in zend_dfa_try_to_replace_result()
1055 ssa->vars[result_var].definition = -1; in zend_dfa_try_to_replace_result()
1056 ssa->vars[result_var].use_chain = -1; in zend_dfa_try_to_replace_result()
1057 ssa->ops[def].result_def = -1; in zend_dfa_try_to_replace_result()
1062 if (ssa->ops[use].op1_use == result_var) { in zend_dfa_try_to_replace_result()
1063 ssa->ops[use].op1_use = cv_var; in zend_dfa_try_to_replace_result()
1064 ssa->ops[use].op1_use_chain = ssa->vars[cv_var].use_chain; in zend_dfa_try_to_replace_result()
1065 ssa->vars[cv_var].use_chain = use; in zend_dfa_try_to_replace_result()
1069 } else if (ssa->ops[use].op2_use == result_var) { in zend_dfa_try_to_replace_result()
1070 ssa->ops[use].op2_use = cv_var; in zend_dfa_try_to_replace_result()
1071 ssa->ops[use].op2_use_chain = ssa->vars[cv_var].use_chain; in zend_dfa_try_to_replace_result()
1072 ssa->vars[cv_var].use_chain = use; in zend_dfa_try_to_replace_result()
1076 } else if (ssa->ops[use].result_use == result_var) { in zend_dfa_try_to_replace_result()
1077 ssa->ops[use].result_use = cv_var; in zend_dfa_try_to_replace_result()
1078 ssa->ops[use].res_use_chain = ssa->vars[cv_var].use_chain; in zend_dfa_try_to_replace_result()
1079 ssa->vars[cv_var].use_chain = use; in zend_dfa_try_to_replace_result()
1093 void zend_dfa_optimize_op_array(zend_op_array *op_array, zend_optimizer_ctx *ctx, zend_ssa *ssa, ze… in zend_dfa_optimize_op_array() argument
1096 zend_dump_op_array(op_array, ZEND_DUMP_SSA, "before dfa pass", ssa); in zend_dfa_optimize_op_array()
1099 if (ssa->var_info) { in zend_dfa_optimize_op_array()
1108 ssa_verify_integrity(op_array, ssa, "before dfa"); in zend_dfa_optimize_op_array()
1112 if (sccp_optimize_op_array(ctx, op_array, ssa, call_map)) { in zend_dfa_optimize_op_array()
1116 if (zend_dfa_optimize_jmps(op_array, ssa)) { in zend_dfa_optimize_op_array()
1121 ssa_verify_integrity(op_array, ssa, "after sccp"); in zend_dfa_optimize_op_array()
1124 if (zend_dfa_optimize_calls(op_array, ssa)) { in zend_dfa_optimize_op_array()
1129 zend_dump_op_array(op_array, ZEND_DUMP_SSA, "after sccp pass", ssa); in zend_dfa_optimize_op_array()
1132 ssa_verify_integrity(op_array, ssa, "after calls"); in zend_dfa_optimize_op_array()
1137 if (dce_optimize_op_array(op_array, ctx, ssa, 0)) { in zend_dfa_optimize_op_array()
1140 if (zend_dfa_optimize_jmps(op_array, ssa)) { in zend_dfa_optimize_op_array()
1144 zend_dump_op_array(op_array, ZEND_DUMP_SSA, "after dce pass", ssa); in zend_dfa_optimize_op_array()
1147 ssa_verify_integrity(op_array, ssa, "after dce"); in zend_dfa_optimize_op_array()
1151 for (v = op_array->last_var; v < ssa->vars_count; v++) { in zend_dfa_optimize_op_array()
1153 op_1 = ssa->vars[v].definition; in zend_dfa_optimize_op_array()
1160 ssa_op = &ssa->ops[op_1]; in zend_dfa_optimize_op_array()
1163 if (ssa->var_info[v].use_as_double) { in zend_dfa_optimize_op_array()
1166 && ssa->ops[op_1].op1_def == v in zend_dfa_optimize_op_array()
1228 ssa->ops[op_1].op1_use = ssa->ops[op_1].op2_use; in zend_dfa_optimize_op_array()
1229 ssa->ops[op_1].op1_use_chain = ssa->ops[op_1].op2_use_chain; in zend_dfa_optimize_op_array()
1230 ssa->ops[op_1].op2_use = -1; in zend_dfa_optimize_op_array()
1231 ssa->ops[op_1].op2_use_chain = -1; in zend_dfa_optimize_op_array()
1248 ssa->ops[op_1].op1_use = ssa->ops[op_1].op2_use; in zend_dfa_optimize_op_array()
1249 ssa->ops[op_1].op1_use_chain = ssa->ops[op_1].op2_use_chain; in zend_dfa_optimize_op_array()
1293 ssa->ops[op_1].op2_use = ssa->ops[op_1].op1_use; in zend_dfa_optimize_op_array()
1294 ssa->ops[op_1].op2_use_chain = ssa->ops[op_1].op1_use_chain; in zend_dfa_optimize_op_array()
1305 && ssa->ops[op_1].op1_def == v in zend_dfa_optimize_op_array()
1306 && ssa->ops[op_1].op1_use >= 0) { in zend_dfa_optimize_op_array()
1307 int orig_var = ssa->ops[op_1].op1_use; in zend_dfa_optimize_op_array()
1308 int ret = ssa->vars[v].use_chain; in zend_dfa_optimize_op_array()
1310 if (ssa->ops[op_1].op1_use_chain == -1 in zend_dfa_optimize_op_array()
1311 && can_elide_return_type_check(ctx->script, op_array, ssa, &ssa->ops[op_1])) { in zend_dfa_optimize_op_array()
1315 zend_ssa_unlink_use_chain(ssa, op_1, orig_var); in zend_dfa_optimize_op_array()
1318 ssa->ops[ret].op1_use = orig_var; in zend_dfa_optimize_op_array()
1319 ssa->ops[ret].op1_use_chain = ssa->vars[orig_var].use_chain; in zend_dfa_optimize_op_array()
1320 ssa->vars[orig_var].use_chain = ret; in zend_dfa_optimize_op_array()
1323 ssa->vars[v].definition = -1; in zend_dfa_optimize_op_array()
1324 ssa->vars[v].use_chain = -1; in zend_dfa_optimize_op_array()
1326 ssa->ops[op_1].op1_def = -1; in zend_dfa_optimize_op_array()
1327 ssa->ops[op_1].op1_use = -1; in zend_dfa_optimize_op_array()
1332 && ssa->ops[ret].op1_use == v in zend_dfa_optimize_op_array()
1333 && ssa->ops[ret].op1_use_chain == -1 in zend_dfa_optimize_op_array()
1334 && can_elide_return_type_check(ctx->script, op_array, ssa, &ssa->ops[op_1])) { in zend_dfa_optimize_op_array()
1338 zend_ssa_replace_use_chain(ssa, op_1, ret, orig_var); in zend_dfa_optimize_op_array()
1340 ssa->ops[ret].op1_use = orig_var; in zend_dfa_optimize_op_array()
1341 ssa->ops[ret].op1_use_chain = ssa->ops[op_1].op1_use_chain; in zend_dfa_optimize_op_array()
1343 ssa->vars[v].definition = -1; in zend_dfa_optimize_op_array()
1344 ssa->vars[v].use_chain = -1; in zend_dfa_optimize_op_array()
1346 ssa->ops[op_1].op1_def = -1; in zend_dfa_optimize_op_array()
1347 ssa->ops[op_1].op1_use = -1; in zend_dfa_optimize_op_array()
1356 && ssa->ops[op_1].result_def == v in zend_dfa_optimize_op_array()
1358 …&& !(ssa->var_info[v].type & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE|MAY_BE_REF)) in zend_dfa_optimize_op_array()
1361 int src_var = ssa->ops[op_1].op1_use; in zend_dfa_optimize_op_array()
1364 && !(ssa->var_info[src_var].type & MAY_BE_REF) in zend_dfa_optimize_op_array()
1365 && (ssa->var_info[src_var].type & (MAY_BE_UNDEF|MAY_BE_ANY)) in zend_dfa_optimize_op_array()
1366 && ssa->vars[src_var].definition >= 0 in zend_dfa_optimize_op_array()
1367 && ssa->ops[ssa->vars[src_var].definition].result_def == src_var in zend_dfa_optimize_op_array()
1368 && ssa->ops[ssa->vars[src_var].definition].result_use < 0 in zend_dfa_optimize_op_array()
1369 && ssa->vars[src_var].use_chain == op_1 in zend_dfa_optimize_op_array()
1370 && ssa->ops[op_1].op1_use_chain < 0 in zend_dfa_optimize_op_array()
1371 && !ssa->vars[src_var].phi_use_chain in zend_dfa_optimize_op_array()
1372 && !ssa->vars[src_var].sym_use_chain in zend_dfa_optimize_op_array()
1374 op_array, ssa, &op_array->opcodes[ssa->vars[src_var].definition], in zend_dfa_optimize_op_array()
1376 && !variable_defined_or_used_in_range(ssa, EX_VAR_TO_NUM(opline->result.var), in zend_dfa_optimize_op_array()
1377 ssa->vars[src_var].definition+1, op_1) in zend_dfa_optimize_op_array()
1380 int orig_var = ssa->ops[op_1].result_use; in zend_dfa_optimize_op_array()
1381 int op_2 = ssa->vars[src_var].definition; in zend_dfa_optimize_op_array()
1387 zend_ssa_unlink_use_chain(ssa, op_1, orig_var); in zend_dfa_optimize_op_array()
1391 ssa->vars[v].definition = op_2; in zend_dfa_optimize_op_array()
1392 ssa->ops[op_2].result_def = v; in zend_dfa_optimize_op_array()
1394 ssa->vars[src_var].definition = -1; in zend_dfa_optimize_op_array()
1395 ssa->vars[src_var].use_chain = -1; in zend_dfa_optimize_op_array()
1397 ssa->ops[op_1].op1_use = -1; in zend_dfa_optimize_op_array()
1398 ssa->ops[op_1].op1_def = -1; in zend_dfa_optimize_op_array()
1399 ssa->ops[op_1].op1_use_chain = -1; in zend_dfa_optimize_op_array()
1400 ssa->ops[op_1].result_use = -1; in zend_dfa_optimize_op_array()
1401 ssa->ops[op_1].result_def = -1; in zend_dfa_optimize_op_array()
1402 ssa->ops[op_1].res_use_chain = -1; in zend_dfa_optimize_op_array()
1417 && ssa->ops[op_2].op1_use >= 0 in zend_dfa_optimize_op_array()
1418 …&& !(ssa->var_info[ssa->ops[op_2].op1_use].type & (MAY_BE_FALSE|MAY_BE_TRUE|MAY_BE_STRING|MAY_BE_A… in zend_dfa_optimize_op_array()
1424 ssa->ops[op_2].result_def = -1; in zend_dfa_optimize_op_array()
1425 ssa->ops[op_2].op1_def = v; in zend_dfa_optimize_op_array()
1433 && ssa->ops[op_2].op1_use >= 0 in zend_dfa_optimize_op_array()
1434 …&& !(ssa->var_info[ssa->ops[op_2].op1_use].type & (MAY_BE_FALSE|MAY_BE_TRUE|MAY_BE_STRING|MAY_BE_A… in zend_dfa_optimize_op_array()
1440 ssa->ops[op_2].result_def = -1; in zend_dfa_optimize_op_array()
1441 ssa->ops[op_2].op1_def = v; in zend_dfa_optimize_op_array()
1449 && ssa->ops[op_2].op2_use >= 0 in zend_dfa_optimize_op_array()
1450 …&& !(ssa->var_info[ssa->ops[op_2].op2_use].type & (MAY_BE_FALSE|MAY_BE_TRUE|MAY_BE_STRING|MAY_BE_A… in zend_dfa_optimize_op_array()
1458 ssa->ops[op_2].result_def = -1; in zend_dfa_optimize_op_array()
1459 ssa->ops[op_2].op1_def = v; in zend_dfa_optimize_op_array()
1460 ssa->ops[op_2].op1_use = ssa->ops[op_2].op2_use; in zend_dfa_optimize_op_array()
1461 ssa->ops[op_2].op1_use_chain = ssa->ops[op_2].op2_use_chain; in zend_dfa_optimize_op_array()
1462 ssa->ops[op_2].op2_use = -1; in zend_dfa_optimize_op_array()
1463 ssa->ops[op_2].op2_use_chain = -1; in zend_dfa_optimize_op_array()
1468 if (ssa->vars[v].var >= op_array->last_var) { in zend_dfa_optimize_op_array()
1473 if (ssa->ops[op_1].op1_def == v in zend_dfa_optimize_op_array()
1479 zend_dfa_try_to_replace_result(op_array, ssa, op_1, v); in zend_dfa_optimize_op_array()
1481 int result_var = ssa->ops[op_1].result_def; in zend_dfa_optimize_op_array()
1484 …&& (ssa->var_info[result_var].type & ((MAY_BE_ANY|MAY_BE_REF|MAY_BE_UNDEF) - (MAY_BE_LONG|MAY_BE_D… in zend_dfa_optimize_op_array()
1485 int use = ssa->vars[result_var].use_chain; in zend_dfa_optimize_op_array()
1488 && ssa->ops[use].op1_use == result_var in zend_dfa_optimize_op_array()
1489 && zend_dfa_try_to_replace_result(op_array, ssa, op_1, v)) { in zend_dfa_optimize_op_array()
1495 int result_var = ssa->ops[op_1].result_def; in zend_dfa_optimize_op_array()
1498 …&& (ssa->var_info[result_var].type & ((MAY_BE_ANY|MAY_BE_REF|MAY_BE_UNDEF) - (MAY_BE_LONG|MAY_BE_D… in zend_dfa_optimize_op_array()
1499 int use = ssa->vars[result_var].use_chain; in zend_dfa_optimize_op_array()
1502 && ssa->ops[use].op2_use == result_var in zend_dfa_optimize_op_array()
1503 && zend_dfa_try_to_replace_result(op_array, ssa, op_1, v)) { in zend_dfa_optimize_op_array()
1512 && ssa->ops[op_1].op1_def == v in zend_dfa_optimize_op_array()
1515 int orig_var = ssa->ops[op_1].op1_use; in zend_dfa_optimize_op_array()
1518 …&& !(ssa->var_info[orig_var].type & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE_RESOURCE|MAY_… in zend_dfa_optimize_op_array()
1520 int src_var = ssa->ops[op_1].op2_use; in zend_dfa_optimize_op_array()
1524 && !(ssa->var_info[src_var].type & MAY_BE_REF) in zend_dfa_optimize_op_array()
1525 && (ssa->var_info[src_var].type & (MAY_BE_UNDEF|MAY_BE_ANY)) in zend_dfa_optimize_op_array()
1526 && ssa->vars[src_var].definition >= 0 in zend_dfa_optimize_op_array()
1527 && ssa->ops[ssa->vars[src_var].definition].result_def == src_var in zend_dfa_optimize_op_array()
1528 && ssa->ops[ssa->vars[src_var].definition].result_use < 0 in zend_dfa_optimize_op_array()
1529 && ssa->vars[src_var].use_chain == op_1 in zend_dfa_optimize_op_array()
1530 && ssa->ops[op_1].op2_use_chain < 0 in zend_dfa_optimize_op_array()
1531 && !ssa->vars[src_var].phi_use_chain in zend_dfa_optimize_op_array()
1532 && !ssa->vars[src_var].sym_use_chain in zend_dfa_optimize_op_array()
1534 op_array, ssa, &op_array->opcodes[ssa->vars[src_var].definition], in zend_dfa_optimize_op_array()
1536 && !variable_defined_or_used_in_range(ssa, EX_VAR_TO_NUM(opline->op1.var), in zend_dfa_optimize_op_array()
1537 ssa->vars[src_var].definition+1, op_1) in zend_dfa_optimize_op_array()
1540 int op_2 = ssa->vars[src_var].definition; in zend_dfa_optimize_op_array()
1545 zend_ssa_unlink_use_chain(ssa, op_1, orig_var); in zend_dfa_optimize_op_array()
1547 ssa->vars[v].definition = op_2; in zend_dfa_optimize_op_array()
1548 ssa->ops[op_2].result_def = v; in zend_dfa_optimize_op_array()
1550 ssa->vars[src_var].definition = -1; in zend_dfa_optimize_op_array()
1551 ssa->vars[src_var].use_chain = -1; in zend_dfa_optimize_op_array()
1553 ssa->ops[op_1].op1_use = -1; in zend_dfa_optimize_op_array()
1554 ssa->ops[op_1].op2_use = -1; in zend_dfa_optimize_op_array()
1555 ssa->ops[op_1].op1_def = -1; in zend_dfa_optimize_op_array()
1556 ssa->ops[op_1].op1_use_chain = -1; in zend_dfa_optimize_op_array()
1571 && ssa->ops[op_2].op1_use >= 0 in zend_dfa_optimize_op_array()
1572 …&& !(ssa->var_info[ssa->ops[op_2].op1_use].type & (MAY_BE_FALSE|MAY_BE_TRUE|MAY_BE_STRING|MAY_BE_A… in zend_dfa_optimize_op_array()
1578 ssa->ops[op_2].result_def = -1; in zend_dfa_optimize_op_array()
1579 ssa->ops[op_2].op1_def = v; in zend_dfa_optimize_op_array()
1587 && ssa->ops[op_2].op1_use >= 0 in zend_dfa_optimize_op_array()
1588 …&& !(ssa->var_info[ssa->ops[op_2].op1_use].type & (MAY_BE_FALSE|MAY_BE_TRUE|MAY_BE_STRING|MAY_BE_A… in zend_dfa_optimize_op_array()
1594 ssa->ops[op_2].result_def = -1; in zend_dfa_optimize_op_array()
1595 ssa->ops[op_2].op1_def = v; in zend_dfa_optimize_op_array()
1603 && ssa->ops[op_2].op2_use >= 0 in zend_dfa_optimize_op_array()
1604 …&& !(ssa->var_info[ssa->ops[op_2].op2_use].type & (MAY_BE_FALSE|MAY_BE_TRUE|MAY_BE_STRING|MAY_BE_A… in zend_dfa_optimize_op_array()
1612 ssa->ops[op_2].result_def = -1; in zend_dfa_optimize_op_array()
1613 ssa->ops[op_2].op1_def = v; in zend_dfa_optimize_op_array()
1614 ssa->ops[op_2].op1_use = ssa->ops[op_2].op2_use; in zend_dfa_optimize_op_array()
1615 ssa->ops[op_2].op1_use_chain = ssa->ops[op_2].op2_use_chain; in zend_dfa_optimize_op_array()
1616 ssa->ops[op_2].op2_use = -1; in zend_dfa_optimize_op_array()
1617 ssa->ops[op_2].op2_use_chain = -1; in zend_dfa_optimize_op_array()
1621 && ssa->ops[op_1].op2_use >= 0 in zend_dfa_optimize_op_array()
1622 && ssa->ops[op_1].op2_def < 0) in zend_dfa_optimize_op_array()
1627 if (ssa->ops[op_1].op1_use != ssa->ops[op_1].op2_use) { in zend_dfa_optimize_op_array()
1628 zend_ssa_unlink_use_chain(ssa, op_1, orig_var); in zend_dfa_optimize_op_array()
1630 ssa->ops[op_1].op2_use_chain = ssa->ops[op_1].op1_use_chain; in zend_dfa_optimize_op_array()
1634 ssa->ops[op_1].result_def = v; in zend_dfa_optimize_op_array()
1635 ssa->ops[op_1].op1_def = -1; in zend_dfa_optimize_op_array()
1636 ssa->ops[op_1].op1_use = ssa->ops[op_1].op2_use; in zend_dfa_optimize_op_array()
1637 ssa->ops[op_1].op1_use_chain = ssa->ops[op_1].op2_use_chain; in zend_dfa_optimize_op_array()
1638 ssa->ops[op_1].op2_use = -1; in zend_dfa_optimize_op_array()
1639 ssa->ops[op_1].op2_use_chain = -1; in zend_dfa_optimize_op_array()
1654 && ssa->ops[op_1].op1_def == v in zend_dfa_optimize_op_array()
1658 && ssa->ops[op_1].op1_use >= 0 in zend_dfa_optimize_op_array()
1659 …&& !(ssa->var_info[ssa->ops[op_1].op1_use].type & (MAY_BE_FALSE|MAY_BE_TRUE|MAY_BE_STRING|MAY_BE_A… in zend_dfa_optimize_op_array()
1669 && ssa->ops[op_1].op1_def == v in zend_dfa_optimize_op_array()
1673 && ssa->ops[op_1].op1_use >= 0 in zend_dfa_optimize_op_array()
1674 …&& !(ssa->var_info[ssa->ops[op_1].op1_use].type & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_TR… in zend_dfa_optimize_op_array()
1682 } else if (ssa->ops[op_1].op1_def == v in zend_dfa_optimize_op_array()
1684 && ssa->ops[op_1].op1_use >= 0 in zend_dfa_optimize_op_array()
1685 …&& !(ssa->var_info[ssa->ops[op_1].op1_use].type & (MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_OBJECT|MAY_BE… in zend_dfa_optimize_op_array()
1692 ssa->ops[op_1].result_def = ssa->ops[op_1].op1_def; in zend_dfa_optimize_op_array()
1693 ssa->ops[op_1].op1_def = -1; in zend_dfa_optimize_op_array()
1705 ssa_verify_integrity(op_array, ssa, "after dfa"); in zend_dfa_optimize_op_array()
1709 zend_ssa_remove_nops(op_array, ssa, ctx); in zend_dfa_optimize_op_array()
1711 ssa_verify_integrity(op_array, ssa, "after nop"); in zend_dfa_optimize_op_array()
1717 zend_dump_op_array(op_array, ZEND_DUMP_SSA, "after dfa pass", ssa); in zend_dfa_optimize_op_array()
1724 zend_ssa ssa; in zend_optimize_dfa() local
1726 if (zend_dfa_analyze_op_array(op_array, ctx, &ssa) == FAILURE) { in zend_optimize_dfa()
1731 zend_dfa_optimize_op_array(op_array, ctx, &ssa, NULL); in zend_optimize_dfa()