}
void scdf_init(zend_optimizer_ctx *ctx, scdf_ctx *scdf, zend_op_array *op_array, zend_ssa *ssa) {
- uint32_t edges_count = 0;
- int b;
-
- for (b = 0; b < ssa->cfg.blocks_count; b++) {
- edges_count += ssa->cfg.blocks[b].predecessors_count;
- }
-
scdf->op_array = op_array;
scdf->ssa = ssa;
scdf->block_worklist_len = zend_bitset_len(ssa->cfg.blocks_count);
scdf->instr_worklist = zend_arena_calloc(&ctx->arena,
- scdf->instr_worklist_len + scdf->phi_var_worklist_len + 2 * scdf->block_worklist_len + zend_bitset_len(edges_count),
+ scdf->instr_worklist_len + scdf->phi_var_worklist_len + 2 * scdf->block_worklist_len + zend_bitset_len(ssa->cfg.edges_count),
sizeof(zend_ulong));
scdf->phi_var_worklist = scdf->instr_worklist + scdf->instr_worklist_len;
typedef struct _zend_cfg {
int blocks_count; /* number of basic blocks */
+ int edges_count; /* number of basic blocks */
zend_basic_block *blocks; /* array of basic blocks */
int *predecessors;
uint32_t *map;